...

View Full Version : Global.asa Session_OnEnd Problem



WilliamHolmes
06-22-2007, 01:51 AM
Hi,

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

It doesnt seem to want to trigger.



Sub Session_OnEnd
Application.lock
Application("ActiveUsers") = Application("ActiveUsers") - 1
Application.unlock
response.Redirect("http://www.yourdomain.com/Session_End.asp")
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 ?

WilliamHolmes
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/";
}
</script>
<%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.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum