I am classing common function in c# class file in asp.net.
HttpContext.Current.Session.SessionID gives object reference not set to an instance error. However I could get session id from codebehind file
I am getting error in the above line. Though I could pass session id from a web page. The above code will considerably save lots of line in main pages.
Could you show the code calling the function? I Created 2 different examples and didn't have any problems. Any other information you can think of would help.
Thanks for your help. We finally found out today we tried to get session id in Global.asax.cs file also. We removed that and from class file we could get session id.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.