Click to See Complete Forum and Search --> : Session expired controlled in one place


rogernem
September 14th, 2010, 07:20 AM
My web.config

<sessionState mode="InProc" />


My Global.asax

void Session_Start(object sender, EventArgs e)
{

Session.Timeout = 1;

string CookieHeaders = HttpContext.Current.Request.Headers["Cookie"];

if ((null != CookieHeaders) && (CookieHeaders.IndexOf("ASP.NET_SessionId") >= 0))
{
// It is existing visitor, but ASP.NET session is expired
Response.Redirect("expired.aspx");

}
}


Then I have 3 pages: default.aspx, page1.aspx and page2.aspx

When I access default.aspx and leave it idle for more than 1 minute I get redirected to expired.aspx as I was supposed to.
But if I click page1.aspx I will not be redirected to expired.aspx again anymore.
I´d like to get redirected no matter what page I´m surfing on and I´d like to control that in just one place if possible, avoiding to have "if(something) redired to xxx.aspx" in every single page.

What should I do to make that happens once my session has expired?