473,783 Members | 2,363 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Session_End only working when browser is left open

5 New Member
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 1791
Plater
7,872 Recognized Expert Expert
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 New Member
yes it is InProc

this seems very bizarre to me....
Sep 23 '08 #3
vickyl
5 New Member
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(ByV al sender As Object, ByVal e As EventArgs)
If session.Count = 1
Dim s As String
Dim path As String = HttpRuntime.App DomainAppPath

For Each s In System.IO.Direc tory.GetFiles(p ath + "\TempReference Files\")
System.IO.File. Delete(s)
Next s
End If
End Sub
Sep 23 '08 #4
Plater
7,872 Recognized Expert Expert
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 New Member
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 Recognized Expert Expert
As far as my testings have shown, when the last session "ends", the Application_End () event fires
Sep 23 '08 #7
vickyl
5 New Member
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 Recognized Expert Expert
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
10804
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; Application.Lock();
2
2382
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 to "<img src=\" + graphfilename + \"/>. This is all working beautifully, however all these ..gif files are going to build up on the server and are going to need deleting. I tried putting some code in the Session_End function in global.asax, but...
0
1095
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 Log very nicely Application_Start, Application_BeginRequest ,
3
566
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 browser (unless I provide a "log out" button that kills the session explicitly, and we can't guarantee the user will click on that). What I am wondering if there are there well-known/documented circumstances under which Session_End will NOT fire...
5
1795
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
2107
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 Session_End(Object sender, EventArgs e) when the user closes the browser window?
6
2141
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 File.Delete() in the Session_End event, but this never seems to run. I've set break points which are never reached... I've added <sessionState mode="InProc" /> to the web.config file...
7
9286
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 know if users have closed down their browsers without logging off first. However, although the code seems to run OK on our development servers (WinXP ASP.NET v. 1.1, SQL Server 2000, IIS6), they don't seem to be firing on the live server despite...
8
5770
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. But, when a user either navigates away from the web app and when the session timesout, the session_end event does not seem to fire. Or when else can I dispose of objects? Or is there an event I can you that is fired when a user navigates away from...
0
9480
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10313
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...
0
10147
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10081
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
9946
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8968
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...
0
6735
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
5378
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5511
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.