
Return to Login Screen on Session Timeout
Hey Paul, the solution to your problem is very easy..
check this out...
at the top of each your pages, check to see if the session variable which
you are using for your flag has not timed out( usually if it has timmed out,
it's value is 0)
so you would use
<%if session("flag")="" then
...
'if the session variable is blank, then it most certainly got timmed out..%>
now hopefully your login screen is nothing really complicated but a user
name text box and a password text box in a form which submits to another asp
page or cgi script which evaluates and validates the values in these input
fields so this is what you would typically do in such a situation...
get the html and/or asp you need for your loggin script.. (which I will call
for sample purposes
[LOGIN_HTML_ASP])
get the normal html and/or asp for the page which is part of your site
[REGULAR_HTML_ASP]
get the asp script which validates all the user information and build a
structure similar to this..
[VALIDATE_ASP]
<!-- Sample Page-->
<html>
<% if session("flag")="" then
'session has timmed out or it's just the first time that the user is
visiting this page and you haven't yet assigned
'a session varaible to him/her so either way, you will have to make them
loggiin.. and not neccesarily by
'redirecting them to another page('that's why asp is so cool') but by just
showing them what they need to
'loggin..
%>
<!--[LOGIN_HTML_ASP] goes here with a hidden input which contains the value
of the location of this page
<input type='hidden' id=location name=location>
<script language='javascript'>
function SubmitForm()
{
// You might just have to submit your loggin form with scripting
technology and not with a simple submit button
// so that you can grab the value of the location of the file which the user
wished to browse when s/he timed out.
document.all.location.value=location.href
document.all.form.submit()
Quote:
}
</script>
-->
<%else
'if it;s not the case and that the user allready has a session variable,
then he/she is ok to continew browsing your page..
%>
<!--[REGULAR_HTML_ASP]-->
<%End if%>
%>
</html>
Now in your VALIDATE_ASP,
after you have processed all of the user's info and they have been
validated,
you would set the redirect of this page to
response.redirect (request.form("location"))
so that now they go back to where they were, with 1 new things, one is a
brand new session variable which will allow them to browse that page at
ease...
this way is probably the best way to do it rather than having to redirect
the user to some other page then the user looses track of what page s/he
was on..
I know this sounds confusing, but right now, I really didn't have the time
to put together a sample app.
if you would like to take a look at one of my sample source codes, e-mail me
and I will reply to you with the source code to do this..
I hope my brief description helped a little bit to put you on the right
track but as I said if it didn't, just e-mail me..
Later
Awah
Quote:
>I am developing an intranet application which needs a timeout feature. The
>timeout is set using the Session object's Timeout property. What I need to
>do is to detect the timeout being reached, and redirect the browser to the
>login page. If I can do this, I then need to prevent anyone re-entering the
>application by pressing the Back button in the browser.
>Anyone know how to do this?
>Thanks
>Paul
>Configuration:
>Development Environment - VI 6
>Target Browser - IE4
>Server - IIS 4