Redirect to login page when asp.net session expires
Still sort of on the same topic, we want our users to be redirected to the login page when the session has expired. Can't add the neccesary code in Session_End as there is no HttpRequest when the server fires Session_End, so Response.Redirect/Server.Transfer won't work.
I found a solution here that Andrew Hopper posted, and it works like a bomb.
“Create a base class that inherits from System.Web.UI.Page. Add a virtual void Page_Load method with the '(Object sender, EventArgs e)' parameters, stick whatever code you need to validate the form login and perform a redirection to the login form if the session is invalidated. Make this class the base class for your other WebForms pages, change the load and include a 'base.Page_Load(sender, e); ' call in the Page_Load event (which you change to be an override). “