Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

another question about Session

Status
Not open for further replies.

KryptoS

Programmer
Feb 7, 2001
240
BE
Hey,

I have a session, when it times-out, I want to go to another page automaticly (is automaticly correct spelled? :) )

So I watch to my screen, do nothing and when the session times-out I want to redirect to another page without doing anything ... is this possible?

greetz
The one and only ASP-sucker
 
look into the Session_OnEnd event that you can specify an action for in your global.asa. I don't use that event, but theoretically, you should be able to specify a response.redirect there, and it should function like you want.

:)
Paul Prewett
penny.gif
penny.gif
 
I'm not totally sure if you can use a response.redirect in the Session_OnEnd, since Session_OnEnd gets called when the session times out. Since the browser no longer has to be there when the session times out, there's a chance that the redirect won't work...
(Response.redirect sends a redirect header to the browser)

I'm interested to know whether this works or not...

leo
 
Try this.
Place the code below between the <head> and </head> tags of the file. Replace X with the number of seconds of your session timeout.
It will not actually be because of your session timing out that the browser will be redirected, but pretty much at the same time. Anyway, it´s the best I can think of...

Code:
<meta http-equiv=&quot;refresh&quot; content=&quot;X;url=http://www.domain.com/pagename.htm&quot;>

Another way to do the same thing is of course in javascript (set a timeout for a change in the location object), but i would do it the meta tag way since it´s part of the html spec.

/gny
 
this:
<meta http-equiv=&quot;refresh&quot; content=&quot;X;url=http://www.domain.com/pagename.htm&quot;>

won't work I think, because it refresh after X-time, wheither you do something or not, and I want only refresh when I do X-time nothing ... for the rest, I'll search and let you know somthing, greetz


 
What do you mean by &quot;doing nothing&quot;? Not requesting another file? When you request another file the clock starts counting down again from X, which is the same thing that happens with the session timeout. Or am I wrong?
As long as you click the link within 10 seconds in the examples below, you don´t get redirected. And if the session timeout is 10 seconds the session doesn´t die.

test.htm
Code:
<html>
<head>
<meta http-equiv=&quot;refresh&quot; content=&quot;10;url=http://www.domain.com/pagename.htm&quot;;>
</head>
<body>
<a href=&quot;test2.htm&quot;>test2</a>
</body>
</html>

test2.htm
Code:
<html>
<head>
<meta http-equiv=&quot;refresh&quot; content=&quot;10;url=http://www.domain.com/pagename.htm&quot;;>
</head>
<body>
<a href=&quot;test.htm&quot;>test</a>
</body>
</html>
 
what's the difference between session-timeout and refresh?

I think:
A session times out after e.g. 20min. When you click somewhere in your website or fill in a form, the timer is set back too zero, and start counting again until it is at 20min. So everytime you do something your session counter is set to zero
A refresh after e.g. 20min, the website will refresh after 20min even if you fill in a form or something else ...

or am I wrong?
 
The difference according to me is where the countdown takes place.
The issue we are discussing is the difference between the session timeout(the server´s timekeeping) and a meta tag which tells the client to refresh after a period of time(the client´s timekeeping). What I´ve been suggesting is that you try to sync the timekeeping between the client and the server so that the client redirects itself after the same period of time that the session timeout is set to.
This is what I thought KryptoS was trying to do. Since there is no way (that I know of) for the server to affect the behaviour of the client between requests, I thought the solution suggested above was a reasonably good one...
Of course, if KryptoS by &quot;doing nothing&quot; doesn´t mean &quot;not requesting a file&quot; my solution will not work, just as you both point out. What you could do then is to use the javascript approach I mentioned earlier, and clear and reset the timeout every time the user causes an event to fire in for example a form. But as I said, that´s not what it sounded like KryptoS was trying to do. After all, the server doesn´t reset the session time just because the user types text in a form field (simply because it will not be aware of it.).
 
oké I'll search for it, you helped me a lot with understanding some basics I didn't know ... thanx for the help ... greetz
 
I don't believe that the session timeout is refreshed when a user clicks a checkbox or fills in a textbox. This would mean that everytime the user edited a form a message was sent back to the server to reset the session timeout. As far as I am aware the session timeout is only refreshed when the server is requested to do something - server up a page normally. Therefore, the refresh method discussed above would work fine.

Hope this helps.

G
-GTM Solutions, Home of USITE-
-=
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top