I am not sure if one can redirect using Session_onEnd, though it can be done, for some reason it doesn't work for me, I haven't played around it enough.
Any page you navigate to, the Server variable - HTTP_REFERER will have the URL of previous page(you came from) as its value. Though you abandon your session, these are still available.
Once the session timed out and the user is redirected to the login page, how do you notify the user that the session timed out? I assume you pass some querystring that you request on login page and based on that you show a message saying "Session expired, re-login." If so...
Then follow this way.
Code:
If Request.Querystring("Timedout")="yes" then URL=Request.ServerVariables("HTTP_REFERER")
...
...
<input type=hidden name="URL" value="<%=URL%>">
On the login page store the URL of previous page in a hidden field and once the user logs in, request for form variable
URL on the page where it gets submitted and if URL not empty, redirect to that value, else land him on the default page after login.
Hope that helps.
Cheers!
_________________________
- Vijay G
Strive for Perfection