INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

Session Timeout Question

Session Timeout Question

(OP)
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

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close