Click here to Skip to main content
15,887,683 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
How to redirect user to logoff page when user is idle for the time specified in web.config. Does it possible using Global.asax's session_end event?

Thanks in advance.
Posted
Comments
ZurdoDev 12-Mar-12 14:36pm    
You need to use client side. ASP.Net is not a connected scenario so you have to use javascript solutions to do this. The session_end even in global.asax is on the server side so you cannot do it there.
Sergey Alexandrovich Kryukov 12-Mar-12 15:04pm    
I would suggest you should not use logoff page. Logoff should be a link placed on every page immediately performing log off. It's easy to implement using the master page, for example.
--SA

1 solution

Please look at javascript timer -
Here[^]
and Here[^].

Set it equal to your session timeout and on timeout navigate to a page that executes the logoff procedure. The user can then be redirected to wherever - the login page for example - telling them their session has expired.

Be careful of this technique if you expect the user to remain on a page for longer than the timeout.

You should back this up with code in Global.asax Session_End to perform any server side logoff processes to guard against browsers being directly closed by users.
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900