473,396 Members | 2,057 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

is session_end event totally USELESS?

We want to redirect a user when the session ends, to a page. It doesn't
seem to work (should it?).
We can put the redirect in the session_start, but this causes other problems
because when the session_starts, we actually want to redirect the user to a
different URL.

Can anyone help us out here? TY in advance!
Jason Shohet
Nov 18 '05 #1
5 2632
When session_end fires there is not necessarily a current HTTP reequest (it
just fires 20 min after you have no news friom the user).

What do you want to do ? Is this to handle session expiration. Usually this
is done the other way round (ie on the next request). It's likeky that .NET
Forms authentication handles this...

Patrice

--

"Jason Shohet" <__******@yahoo.com> a écrit dans le message de
news:OJ**************@TK2MSFTNGP09.phx.gbl...
We want to redirect a user when the session ends, to a page. It doesn't
seem to work (should it?).
We can put the redirect in the session_start, but this causes other problems because when the session_starts, we actually want to redirect the user to a different URL.

Can anyone help us out here? TY in advance!
Jason Shohet

Nov 18 '05 #2
I don't think you could redirect or transfer in application or session
events. They are different threads and not related to page.
If you want to handle error, set error page in web.config file and throw an
exception in session_onend. The application will redirect to the error
page.

"Patrice" <no****@nowhere.com> wrote in message
news:ex**************@TK2MSFTNGP12.phx.gbl...
When session_end fires there is not necessarily a current HTTP reequest (it just fires 20 min after you have no news friom the user).

What do you want to do ? Is this to handle session expiration. Usually this is done the other way round (ie on the next request). It's likeky that ..NET Forms authentication handles this...

Patrice

--

"Jason Shohet" <__******@yahoo.com> a écrit dans le message de
news:OJ**************@TK2MSFTNGP09.phx.gbl...
We want to redirect a user when the session ends, to a page. It doesn't
seem to work (should it?).
We can put the redirect in the session_start, but this causes other problems
because when the session_starts, we actually want to redirect the user

to a
different URL.

Can anyone help us out here? TY in advance!
Jason Shohet


Nov 18 '05 #3
Thanks Mimi, Patrice,

I'm also looking at another way (the error page thing sounds interesting
too). Create a base page, and put this in the page_load event (and all
pages of the app inherit from the base page):

Response.AppendHeader("Refresh", Convert.ToString((Session.Timeout * 60)
+ 5) + "; URL=loginpage.aspx");

I believe this works, haven't tried it yet but seems there are those that
have done this and managed to "fool" a redirect on session_end....

TY
Nov 18 '05 #4
As said earlier I would just do this on the next request to avoid having the
application doing something the user didn't asked for (he could be
surpesised to go to luanch and find him on the login page when he comes back
; it is clearier IMO for him if he does something with the page and then
sees he should log again).

You could also look before if this is not done for you depending on the .NET
authentication method you are using (could be IMO for forms authentication).

If not you could likely do this in the Application_BeginRequest test for a
new session (there is even a property for this).
Patrice

--

"Jason Shohet" <__******@yahoo.com> a écrit dans le message de
news:O1**************@TK2MSFTNGP12.phx.gbl...
Thanks Mimi, Patrice,

I'm also looking at another way (the error page thing sounds interesting
too). Create a base page, and put this in the page_load event (and all
pages of the app inherit from the base page):

Response.AppendHeader("Refresh", Convert.ToString((Session.Timeout * 60)
+ 5) + "; URL=loginpage.aspx");

I believe this works, haven't tried it yet but seems there are those that
have done this and managed to "fool" a redirect on session_end....

TY

Nov 18 '05 #5
Hi Patrice. Thanks again for your comments, I really appreciate it.
In this case, if he goes to lunch it might be ok to return to the login
page, even though he doesn't request a page... its a timekeeping system and
we'll clearly explain that they are supposed to log out (not leave it
running).

Application_start is definately out since we have other code in there it
would conflict with. Application_beginRequest, I'm not sure what this is
(different than application_start?). I suppose the error page for the site
might be ok but won't that trap all errors? I want the user to see the
actual error screens (that tell me which line etc if something blows up),
I'd rather not mask it because if there's a legit error I want to see the
full error text. This is a case where we really don't have an 'error' per
se, just a redirect on session end.

I might try the way in my last posting first. We can also redirct the user
to a page that says "You were logged out because you left the application up
too long... click here to return to the login page..." and that might be
more user friendly. TY once again for your tips & help
As said earlier I would just do this on the next request to avoid having the application doing something the user didn't asked for

Nov 18 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: raj | last post by:
Hi, I am facing a problem of automatic session timeout problem and automatic session_end event fired. Case1: As I have analyzed I get to know that the default session timeout is 20 in...
2
by: Chris Sibel | last post by:
Hey guys I have a user tracking setup to track users. What it does is once a user hits my site it sends me an email telling me some info and once a user clicks the logout button it sends a second...
2
by: Bela | last post by:
Hello I was wondering if someone could help me out with a Session_End problem in my Global.asax. I've tried everything, and still no success Here is the scenario: sessionstate is set to InProc....
8
by: howard39 | last post by:
When SQL Server 2003 is *not* configured in IIS5 isolation mode, is it true that the Session_End event can not be depended on? If so, what is a good way to clean up unmanaged resources that were...
5
by: Lars Netzel | last post by:
In Global asax the Session_End Sub fires off every now and then. I only want it to fire when I call Session.Abandon() but it fires off totally randon when just suring around in my ASP.NET solution....
11
by: OldProgrammer | last post by:
All the documentation and discussion I have read indicate that the Session_End is not supposed to fire unless you are in "inProc" Session state mode, and then only on Session Timeout or at Session...
8
by: Roger | last post by:
When I call the session.abandon() method, it calls the session_end event. When a user closes the browser or clicks the log off button, I can dispose of objects and abandon the session cleaning....
1
by: =?Utf-8?B?YnJlbnQ5NjA=?= | last post by:
Environment: ASP.NET 2.0, SQL Server 2005, C#, Visual Studio 2005 In my Session_End event, I am executing a stored procedure to update a database table that is used to log user sessions. When...
12
by: =?Utf-8?B?QWxleCBNYWdoZW4=?= | last post by:
Hi. I am trying to maintain a list of people who are currently "online" in SQL. I do this by adding a simple entry to a simple PeopleOnline table whenever someone logs in to my site. If they...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.