473,396 Members | 2,036 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.

Session_End only working when browser is left open

5
Hi,

I've been having this problem for the pas few days so i thought i'd post and see if anyone could help.

I have an application that has code to delete file in Session_end. When i start a session and then do nothing in the browser for the timeout amount of time, session_end fires and the code works....the files get deleted. However, if i close the browser and wait the same amount of time (or longer) Session_End never fires. I know that closing the browser doesn't call session_end....i am actually waiting the timeout amount of time but Session_end just never fires.....Is there something about Session_end and closing browsers that i am not aware of?

Thanks in advance to anyone who can help :)

vicky
Sep 23 '08 #1
8 1779
Plater
7,872 Expert 4TB
Session_End() should fire after the timeout time, regardless of if browser is left open or is closed.
Is your Session type set to "InProc" (I think that's the default)
Sep 23 '08 #2
vickyl
5
yes it is InProc

this seems very bizarre to me....
Sep 23 '08 #3
vickyl
5
this is the code i have in my session_end. i am testing on my machine and no one else has access so session.count should always be 1....which it is when i keep the browser open....but seems to change when i close the browser:


Sub Session_End(ByVal sender As Object, ByVal e As EventArgs)
If session.Count = 1
Dim s As String
Dim path As String = HttpRuntime.AppDomainAppPath

For Each s In System.IO.Directory.GetFiles(path + "\TempReferenceFiles\")
System.IO.File.Delete(s)
Next s
End If
End Sub
Sep 23 '08 #4
Plater
7,872 Expert 4TB
Why do that at every session_end(), wouldn't that mess up anyone else trying to use the stite?
You could do it in Application_End()?

EDIT:
As for why the session count goes up, when you close your browser and then goto website again, you will get a new session, so the count will go up.
Sep 23 '08 #5
vickyl
5
well that's why i check if any other sessions are open....if there are more than one it doesn't delete (at least that's what i'm trying to do).

also, at the moment i have my timaout set at 1 minute for testing purposes and i'm not opening any other browsers.....so there should only always be 1 session open at a time
Sep 23 '08 #6
Plater
7,872 Expert 4TB
As far as my testings have shown, when the last session "ends", the Application_End() event fires
Sep 23 '08 #7
vickyl
5
ok i may have misunderstood the session_end....i was under the impression that it fired every time a session would timeout....not just the last one
Sep 23 '08 #8
Plater
7,872 Expert 4TB
ok i may have misunderstood the session_end....i was under the impression that it fired every time a session would timeout....not just the last one
No you are correct, it *should* fire for every session that ends (as long as session is listed as "InProc"). However after the last session has ended, my application seems to call the application_end() function and shut itself down.
Sep 23 '08 #9

Sign in to post your reply or Sign up for a free account.

Similar topics

9
by: Kenn Ghannon | last post by:
I've got an ASP.NET page with a counter subtraction routine in the Session_End method in the Global.asax.cs: protected void Session_End(Object sender, EventArgs e) { ulong curUsers; ...
2
by: Bonj | last post by:
Hi I have an ASP.NET application which implements a server-side charting solution, for this it needs to generate .gif files which are then sent to the browser via a literal which has its text set...
0
by: Chris | last post by:
Hi, I entered some logging-stuff in global.asax : namely in Application_Start(), Application_End(), Session_Start() , etc .... When I start the ASP.NET app from within Visual Studio does it...
3
by: Guadala Harry | last post by:
Just wondering if Session_End *always fires* for every Session. I know that IIS times out sessions after a default 20 min (unless changed) and there's no way to know when a user actually closed a...
5
by: Raed Sawalha | last post by:
in our multiple applications solutions which is as follows: Parent : Global.ascx Logout.aspx SubProj1 No Global or logout SubProj2 No Global or logout
6
by: Annie | last post by:
Hi guys, I just want to do some clean up in the Session_End at Global.aspx. However, if the user closes the browser window that event is not fired. how can I call explicity protected void...
6
by: Calvin Willman | last post by:
ASP.NET 2.0, Visual Web Developer Express I've written a web app, which creates a Gif to display on the page. I name it .gif, and only want it to last as long as the session, so I've included ...
7
by: Bruno | last post by:
We are attempting to automatically log users off from the Session_End event in global.asax and set some values on session_start. It is not a critical task, more of a housekeeping task so that we...
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....
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: 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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
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
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,...
0
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...

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.