I got rid of the base page, which was originally.
Put this in Session_Start from Global.asax
void Session_Start(object sender, EventArgs e) { string cookie = Request.Headers["Cookie"]; // Code that runs when a new session is started if ((null != cookie) && (cookie.IndexOf("ASP.NET_SessionId") >= 0))//&& !Request.QueryString["timeout"].ToString().Equals("yes")) { if(Request.QueryString["timeout"] == null || !Request.QueryString["timeout"].ToString().Equals("yes")) Response.Redirect("Default.aspx?timeout=yes"); } }
Put this on the Defualt.aspx page:
if (!IsPostBack) { if (Request.QueryString["timeout"] != null && Request.QueryString["timeout"].ToString().Equals("yes")) { Response.Write("<script>" + "alert('Your Session has Timedout due to Inactivity');" + "location.href='Default.aspx';" + "</script>"); } }
This solution works even when a timeout occurs on the Default.aspx page.
The discussion for the solution used is here: How to stop the base page from recursively detecting the session timeout
source share