I want to sign out a user when his session times out. So used following code in Global.asax:
protected void Session_End(object sender, EventArgs e)
{
For
I don't know if it is a feature or bug. Or may be I don't understand enough session managment in ASP.NET. But this is what I found.
Session_End does not fire in ASP.NET MVC 4 (with default settings for sessionState element in web.config) if Session_Start is not declared.
So you need declare Session_Start to catch Session_End :)
protected void Session_Start(Object sender, EventArgs e) { }
protected void Session_End(Object sender, EventArgs e) {
Debug.WriteLine("End. " + Session.SessionID);
}