Global.asax

R

ruca

Hi,
How can I Redirect my web application to a page when a session ends? (I've
set a timeout)

I have this in my Global.asax in Session_End Event:
Context.Response.Redirect("login.aspx")

but it doesn't work
 
P

Philip Q [MVP]

ruca said:
Hi,
How can I Redirect my web application to a page when a session ends? (I've
set a timeout)

I have this in my Global.asax in Session_End Event:
Context.Response.Redirect("login.aspx")

but it doesn't work

The Session_End event is meant for clearing up any objects or items that
you have created for the session, you cannot interactively do anything
with the user.

When a session closes, it is usually because of a timeout because the
user has not requested anything from the server and the connection has
been lost (eg. the user has closed the browser).

The Session_End event is not triggered by the user, so you cannot do
anything with it.

You can only redirect the user when the next session starts again.
 
H

Hans Kesting

ruca said:
Hi,
How can I Redirect my web application to a page when a session ends? (I've
set a timeout)

I have this in my Global.asax in Session_End Event:
Context.Response.Redirect("login.aspx")

but it doesn't work


--
Programming ASP.NET with VB.NET
Thank's (if you try to help me)
Hope this help you (if I try to help you)
ruca

When the session ends, there is no request to respond to (there has been
no request for the past 20 minutes, so the browser may have been closed
or even the internet connection to that browser is off)

What you probably want to do is, if the browser has displayed the last
screen for too long, redirect to a login page.
This is impossible from the server side, but possible from client side:
use <meta http-equiv=refresh> to redirect after the session should have
been expired.
Note: this may start a new session!

Hans Kesting
 
P

Patrice

This event doesn't arise when there is currently a http request. You can't
do that.

Instead Session.IsNewSession allows to know the user starts a new session.
What's happening for now (it could perhaps depend also on the authorization
scheme currently in use ?)

Patrice
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,066
Latest member
VytoKetoReviews

Latest Threads

Top