CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 1 of 1

Threaded View

  1. #1
    Join Date
    Nov 2004
    Posts
    187

    Angry Session expired controlled in one place

    My web.config
    Code:
    <sessionState mode="InProc" />
    My Global.asax
    Code:
    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&#180;d like to get redirected no matter what page I&#180;m surfing on and I&#180;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?
    Last edited by rogernem; September 14th, 2010 at 07:23 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured