DeanCovey
Posts: 22
|
| Posted: 02/15/2007, 10:08 AM |
|
I seen several post regarding this subject. I am just posting how I do it. I'm not going to say this the best or only way to do this. Users seem to really like it.
I create an an include-able page called timeout. The code is for this page is:
<%
Function timeout_BeforeShow(Sender) 'timeout_BeforeShow @1-6277FFB4
'Declare Variable @2-4A7E587B
Dim advancedwarning
advancedwarning = 1
'End Declare Variable
'Declare Variable @3-0294EA11
Dim jsLogout
jsLogout = 0
'End Declare Variable
'Custom Code @4-73254650
jsLogout = (session.Timeout - advancedwarning) * 60000
%>
<script>
window.setTimeout("top.location='/logout.asp?auto=1'",<%=jsLogout%>);
</script>
<%
' -------------------------
'End Custom Code
Set jsLogout = nothing
Set advancedwarning = nothing
End Function 'Close timeout_BeforeShow @1-54C34B28
%>
You may have to adjust your link for relevant or absolute position. I create a button for my navigation that goes to a logout page. the logout page tells they user they have logged out and performs the actual logout function. If you notice on my timed logout there is a parameter. If that parameter is 1, then the logout pages tells the user:
The server has logged you out due to inactivity.
Any pending changes could not be saved.
The server logged you out at 02/15/2007 12:56 PM
Other wise the logout page tells the,
You have successfully logged out.
You logged out at 02/15/2007 12:59 PM
On every secured page I create, I just include the timeout.asp page with it. Works great!!
Feel free to modify this code for your own needs.
|
 |
 |
|