468,242 Members | 1,710 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,242 developers. It's quick & easy.

Automatic Redirect Of Page after Session Expire

windows_mss
hi Programmers,

In course of my project now i facing an proble that i have to Redirect the page to some other Page after the Default Session Time Expire
Expand|Select|Wrap|Line Numbers
  1. <sessionState 
  2.             mode="InProc"
  3.             stateConnectionString="tcpip=127.0.0.1:42424"
  4.             sqlConnectionString="data source=127.0.0.1;Trusted_Connection=yes"
  5.             cookieless="false" 
  6.             timeout="10" 
  7.     />
  8.  
  9.  
Here my Default time is 10, If User is Idel for more than 10 min in that case page should be automatically redirected into some other page.

Help Needed,

Thanks In Advance
Mar 6 '07 #1
2 7380
Frinavale
9,735 Expert Mod 8TB
hi Programmers,

In course of my project now i facing an proble that i have to Redirect the page to some other Page after the Default Session Time Expire
...

Here my Default time is 10, If User is Idel for more than 10 min in that case page should be automatically redirected into some other page.

Help Needed,

Thanks In Advance
Hello!

I remember solving this problem not too long ago. My solution might not be the best one out there but it's simple enough. Whenever one of my pages did a postback I'd check if the session was new...if it was then their session had expired or they had tried to jump to a page without going through the proper channels.

In every piece of code that handles a post back I inserted the following:
Expand|Select|Wrap|Line Numbers
  1. If Session.IsNewSession = False Then
  2.      'Do processing here because the session hasn't expired
  3. Else 
  4.      'This is the case when the session has expired...
  5.       'so we don't process anything and just transfer/redirect 
  6.       'back to the beginning
  7.       Server.Transfer("StartPage.aspx", False)
  8. End If
  9.  
Cheers
-Frinny
Mar 6 '07 #2
What Frinny does is good, as I also on every page load I check the value of the session and if the session is nothing then I redirect to a default page expired.

The only way you can make it go there automatically after 10 minutes is to run a timer. ( I think- from years ago when I tried)

Have fun! T
Mar 8 '07 #3

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

4 posts views Thread by Chris Stegeman | last post: by
3 posts views Thread by bbgraph | last post: by
12 posts views Thread by gigi | last post: by
5 posts views Thread by =?Utf-8?B?Y2hlY2tyYWlzZXJAY29tbXVuaXR5Lm5vc3BhbQ== | last post: by
reply views Thread by NPC403 | last post: by
reply views Thread by kermitthefrogpy | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.