If I store a value in a session variable
Session["Int"] = 100;
What it will be in the Session_End event? Will it be null or 100?
void Session_End(object sender, EventArgs e)
{
object objInt = Session["Int"]; // Null or 100 ?
}
Meaning, will Session_End fire after disposing everything in the session or just before?
I found that Session["Int"] will be 100. I set the session timeout to just 1 minute and put a break point in that event.
It is 100.
To test it yourself simply add the ASP.NET application file
global.asax
to your project and handle theSession_Start
endSession-End
events:You can end a Session by
Session.Abandon()
(or when it expires).