Click here to Skip to main content
15,889,281 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Exception Description : Session state is not available in this context

I am getting this exception in my global.asax
Posted

1 solution

Try this,
HttpContext.Current.Session("Session_Name")

Any doubt see this,
http://toniyojackson.blogspot.com/2010/09/accessing-session-in-class-file-in.html[^]
 
Share this answer
 
Comments
swathi.N 13-Dec-10 6:59am    
i tried it , by copying this code in application_error and i have declared in session_start
session["session_name"]=request.browser;

but i am getting some compilation error ,what i did is right or wrong?
can u suggest me
Toniyo Jackson 13-Dec-10 7:03am    
Why u r using request.browser?
Just use Session.SessionId.ToSting();
swathi.N 13-Dec-10 7:13am    
Sorry,i dint get you.
can u explain, session state is not available in this context, what it means
Toniyo Jackson 13-Dec-10 7:16am    
That is the reason i given u above answer. To access session in global.asax page u need to use HttpContext.Current.Session["Session_Name"].

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900