473,503 Members | 338 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Session_OnEnd

Is there a way to warn the user that there Session is about to end? I'm
using Forms authentication and when there session ends it takes them
back to the login screen like it is designed to do.
Also it there anyway to make it take the user to a different page once
the session ends?
Thanks

Nov 19 '05 #1
3 1339
Hi BillGatesFan,
Is there a way to warn the user that there Session is about to end?
Yes. You would have to know the Session Timeout, and add a JavaScript to
each page that uses the JavaScript setTimeout() function to execute a
JavaScript function shortly before the timeout.
Also it there anyway to make it take the user to a different page once
the session ends?
The user may be out playing basketball by the time the Session ends. (IOW,
no)

Let me explain: Session timeout occurs when NO REQUESTS have been made for a
period of (usually) 20 minutes. Without a Request, how can there be a
response?

However, using the technique I described above, you could do a client-side
redirect just prior to the Session timeout. Of course, keep in mind that the
new Request will reset the timeout, and the Session will not end, unless you
call Session.Abandon on the target page.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
Neither a follower nor a lender be.

"BillGatesFan" <kl******@hotmail.com> wrote in message
news:11**********************@l41g2000cwc.googlegr oups.com... Is there a way to warn the user that there Session is about to end? I'm
using Forms authentication and when there session ends it takes them
back to the login screen like it is designed to do.
Also it there anyway to make it take the user to a different page once
the session ends?
Thanks

Nov 19 '05 #2
Hi BillGatesFan,

Have a client side script using window.setInterval() method to fire a yes/no
window to fire near the session end time..

SetInterval: Evaluates an expression each time a specified number of
milliseconds has elapsed..
Check this link for more information..
http://msdn.microsoft.com/workshop/a...etinterval.asp

Once the session times out either you can refresh the page and check on the
post back and redirect him to login page or alert him...

Hope this helps..

Need any help, do post a msg back

Happy Coding

"BillGatesFan" wrote:
Is there a way to warn the user that there Session is about to end? I'm
using Forms authentication and when there session ends it takes them
back to the login screen like it is designed to do.
Also it there anyway to make it take the user to a different page once
the session ends?
Thanks

Nov 19 '05 #3
Add this to every page_load that you want the redirect on timeout to happen

Response.AppendHeader("Refresh", Convert.ToString((Session.Timeout * 60) +
10) & ";URL=timeout.aspx")

This will redirect to a page after a specified interval in seconds.

You could also use this method to redirect to a warning page by changing the
'+10' to a '-30', checking that the result is > 0, and the url to your
warning page. In page load of your warning page, set the refresh to redirect
to your login page or some sort of message page when the timeout actually
occurs.

HTH..
"BillGatesFan" <kl******@hotmail.com> wrote in message
news:11**********************@l41g2000cwc.googlegr oups.com...
Is there a way to warn the user that there Session is about to end? I'm
using Forms authentication and when there session ends it takes them
back to the login screen like it is designed to do.
Also it there anyway to make it take the user to a different page once
the session ends?
Thanks

Nov 19 '05 #4

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

Similar topics

3
3046
by: Tom Bates | last post by:
I can successfully delete files using fso.DeleteFile when in an ASP script. But in Session_OnEnd, where I'd *really* like to clean up files, it appears that DeleteFile doesn't work. I've tried...
3
3688
by: cab | last post by:
i have the following code in the "Sub Session_OnEnd" routine that does not seem to run..... Sub Session_OnEnd strConnect = "Driver={SQL Server};Server=SERVER;Database=database; User...
24
2424
by: Nancy Drew | last post by:
hi all i'm trying to keep users from being able to login to a site twice at the same time. everytime a user does a login, i stick their userID into an application scoped array. if they try to...
14
3943
by: Agoston Bejo | last post by:
Hi! Why doesn't the following code work? Sub Session_OnEnd Dim Conn Set Conn = Server.CreateObject("ADODB.Connection") Conn.ConnectionString = Application("Connection_String") Conn.Open ...
4
6761
by: Propin | last post by:
Have a problem with below code in global.asa. Same problem as described in this news group before, IWAM_machinename did not solve my problem. Have created the following test code (file is never...
4
2554
by: anand | last post by:
In my website i want to trace the event when user log off from the site by closing the explorer so i am unable to run any server side program at that time and my session_onend event also not...
6
2565
by: Martin | last post by:
Hi, Since I went ASP.NET with my global.asa (making it a global.asax) the application events are called just fine as well as the Session_OnStart event but the Session_OnEnd event is not. What is...
1
2123
by: Andy Kasotia | last post by:
My Session_OnStart works but Session_OnEnd does not work. Here's the code...can anyone tell me what's wrong with my code or if anything else on the server that needs to be changed. The...
11
2073
by: David Thielen | last post by:
Hi; Is there some kind of session ID variable that I can get in the code behind and that is available in Session_OnEnd() to know what session ended? -- thanks - dave...
4
1629
by: Chris Ashley | last post by:
There seem to be isolated occurences of Session_OnEnd not firing in my app. This is problematic because some clean up of resources happens here. I know the Session events were unreliable in classic...
0
7203
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7281
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,...
1
6993
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7462
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
5014
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4675
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3168
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
1514
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
737
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.