473,657 Members | 2,409 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 1346
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.

"BillGatesF an" <kl******@hotma il.com> wrote in message
news:11******** **************@ l41g2000cwc.goo glegroups.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.setInter val() 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

"BillGatesF an" 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.Append Header("Refresh ", Convert.ToStrin g((Session.Time out * 60) +
10) & ";URL=timeout.a spx")

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..
"BillGatesF an" <kl******@hotma il.com> wrote in message
news:11******** **************@ l41g2000cwc.goo glegroups.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
3062
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 every combination I could think of. I've verified the filespecs I'm using by logging to a session log file. BTW, I found out the hard way that I can't reference Request.ServerVariables("APPL_PHYSICAL_PATH") from within Session_OnEnd. I had to copy...
3
3705
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 ID=xxxxxx;Pwd=xxxxxxx" Set objConnEnd = Server.CreateObject("ADODB.Connection") objConnEnd.Open strConnect
24
2452
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 login again, i bounce them to an error page. i use the session_onEnd sub within global.asa to remove their userID from the array at the end of their session, and this seems to work fine. however, if i just shut down the browser, the sub_onEnd...
14
3955
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 'here is the error .... End Sub
4
6792
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 deleted on my IIS6 Win2003 environment, any idea?): <SCRIPT LANGUAGE="VBScript" RUNAT="Server"> Sub Application_OnStart End Sub
4
2572
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 working can any one tell me why the session_onend is not working. Thanx in advance
6
2584
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 wrong? My global.asax looks like this: <%@ Application src="app.cs" Inherits="mwte.App" %>
1
2134
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 Session_OnStart does create the folder for me with the SessionID as the folder name but Session_OnEnd does not delete that folder. Sub Session_OnStart Dim fso, f, DirToCreate 'Create a folder to store PDF Files Set fso =...
11
2096
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 david_at_windward_dot_net http://www.windwardreports.com
4
1637
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 ASP, but is this still the case in ASP.Net? What kind of scenarios would case Session_OnEnd not to fire? Would Application_Error being hit cause Session_OnEnd not to fire?
0
8395
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8826
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8503
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7330
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6166
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5632
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4306
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2726
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 we have to send another system
2
1955
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.