Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Session Timeout Question

Status
Not open for further replies.

dvannoy

MIS
May 4, 2001
2,765
US
I need some info on how to handle session time outs on web forms.

So, I have the following code on each one of my pages form load event;

Code:
If Not IsPostBack Then

            If Session("User") IsNot Nothing AndAlso Session("Group") IsNot Nothing Then
                ' let them access the page.
               My User and Group code Here

            Else
                'clear the cache and  redirect back to login page.
                Response.Cache.SetExpires(DateTime.UtcNow.AddMinutes(-1))
                Response.Cache.SetCacheability(HttpCacheability.NoCache)
                Response.Cache.SetNoStore()
                Session.Abandon()
                Response.Redirect("~/Expired.aspx")
            End If
End If

Now, as you can see this just handles the page load event. Sometimes this doesn't seem to work correctly. meaning sometimes if a session expires I get the yellow asp.net error page instead if the Response.Redirect("~/Expired.aspx")

Just looking for thoughts on how to handle expired sessions with a redirect back to login. Maybe not putting the code in the page load event ??

any help would be appreciated

thanks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top