View Full Version : Global.asa Session_OnEnd Problem

06-22-2007, 01:51 AM

Im having some problems with the Sub Session_OnEnd within the Global.asa

It doesnt seem to want to trigger.

Sub Session_OnEnd
Application("ActiveUsers") = Application("ActiveUsers") - 1
End Sub

All i want to do is response.redirect the user that his/her session has ended (of course only if he/she is still on the website)

Any ideas ?

06-22-2007, 05:36 PM
Ok after some research i found that this is a common problem.

So... this is my solution...

i have an include page in all webpages on my website pages so i included the following within it..

My Session.timeout = 30

Within the include asp file i have ...

<% if Session("login") = "true" then %>
<script language="javascript">
//this will call the javascript method _SessionExpired after 20 minutes

setTimeout( "_SessionExpired()", 31 * 60 * 1000 );

function _SessionExpired()
alert('Your Session had Expired')
location.href = "http://www.mydomain.com/";
<%end if%>

I set the javascript timeout to 31 minutes to allow the session.timeout to completley timeout before the javascript.

This seems to work...as i change the page the session.timeout resets and so does the javascript.