-
Logg Of
Hi there
I hope some one can help me I'm trying to send a User to a separate page once the session expires or after a set amount of time .. See http://www.vbforums.com/showthread.p...1&goto=newpost for a previous post of mine.
I was thhinking about it and I'm wondering if i counld put somethign like a Timer into the code that will fire lets say a Javascript that will redirect said user to a diffrent page ... is this at all possible?
Any other ideas?
Thanks in Advance!
-
You could use the http refresh meta tags. This will send the user to yahoo in 30 seconds. Put it between the head tags. You could also do the same via javascript.
Code:
<meta http-equiv="Refresh" content="30;url=http://www.yahoo.com/">
-
or use 'session.timeout = x' where x is a number in minutes that you'd like to end... this will override the length set in iis... and can be changed multiple times... also, in global.asa... you may be able to use a Response.Redirect within the 'Session_OnEnd' method... seems that this code would work... i've never tried it, but i don't see why it wouldn't work... what the heck, i've nothing more fun to do right now... i'm going to try it... good luck!
-
Session_OnEnd is not reliable enough to put code in it that must be executed when the session ends...
plus it is really intended for cleanup code not to redirect or anything... (Although in theory you probably could.. what if the user isn't connected when the session expires?)
-
javascript 1.2 supports execution of code in intervals using the function 'setInterval(function, interval, arguments)'... i believe that this form works in all versions of nutscrape, and ie 5+... with ie 4, you should use 'setInterval(code, interval)'... not sure if you are able to call a function with this form... also, you can use 'setTimeout(code, delay)' to defer the execution of code... to redirect a window, i believe that you would use 'document.location' or 'document.URL' ... good luck!
btw... i did try that earlier code... and monte is correct.. it doesn't work... you'll probably end up having to create a single script that simply abandons the session, which cleans up memory, and then redirects to the new page...
-
Howzit.
Well The problem is that all your suggestions are what I have thought about and rethinked it some more, the only problem is that for any of those to work the users browser must be active with the page displayed.
What if the user closes his browser and is still logged in? How would I go about logging the user out, the only way I can think of doing this is to put it into the Global.asa's sub Session_onEnd event. But as you told me and I came to see Response.redirect doesn't work in there also I think that Session("Variable") can't be called in the session as the Variable will be probably killed when the session times out
I can put it in the Application("Variable") but surely when another person logs in that will be over written with the new person's details.
I was also thinking of using a Cookie on the users system that will have details to see if the user logged off or not, I could then block the user from loggin in if he didn't log in, but that pretty much is a Stupid move as I want to logg the user off to have him be able to logg back in.
Thanks for your help!