473,793 Members | 2,865 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Session_End not firing

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 [SessionID].gif, and only want it to last as long as the session, so I've
included

File.Delete([filepath]) 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...

what's the problem??

Thanks in advance
Mar 2 '06 #1
6 2141
> 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
[SessionID].gif, and only want it to last as long as the session, so I've
included

File.Delete([filepath]) 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...

what's the problem??

Thanks in advance


When do you expect that Session_End to run?

It will run when the session times out, which is by default 20 minutes
after the last page has been requested.

Hans Kesting
Mar 2 '06 #2
Thanks for your reply Hans,
I'm expecting it to run when the user closes the browser...

It's strange. I think it's working, but it's taking roughly 3 minutes for
the image to actually disappear from the folder. Also, the break point is
never encountered.

I've been testing including the <sessionState > element in the web.config
file in the Windows\Microso ft.Net\Config folder and I think it is that which
is making it work, rather than the application's web.config file. Infact I'm
pretty sure it's only working if I put it in the Windows directory.

It's very annoying, as using Session_End was fine in VS 2003.

"Hans Kesting" <ne***********@ spamgourmet.com > wrote in message
news:mn******** *************** @spamgourmet.co m...
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 [SessionID].gif, and only want it to last as long as the session,
so I've included

File.Delete([filepath]) 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...

what's the problem??

Thanks in advance


When do you expect that Session_End to run?

It will run when the session times out, which is by default 20 minutes
after the last page has been requested.

Hans Kesting

Mar 2 '06 #3
You'll never get it to fire when the browser closes as IIS cannot know
when this happens. It fires when the session expires or is explicitly
closed.

I don't understand because you are seeing the correct behavior after 3
minutes. Isn't this what you want?

Regards
Ray

Calvin Willman wrote:
Thanks for your reply Hans,
I'm expecting it to run when the user closes the browser...

It's strange. I think it's working, but it's taking roughly 3 minutes for
the image to actually disappear from the folder. Also, the break point is
never encountered.

I've been testing including the <sessionState > element in the web.config
file in the Windows\Microso ft.Net\Config folder and I think it is that which
is making it work, rather than the application's web.config file. Infact I'm
pretty sure it's only working if I put it in the Windows directory.

It's very annoying, as using Session_End was fine in VS 2003.

"Hans Kesting" <ne***********@ spamgourmet.com > wrote in message
news:mn******** *************** @spamgourmet.co m...
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 [SessionID].gif, and only want it to last as long as the session,
so I've included

File.Delete([filepath]) 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...

what's the problem??

Thanks in advance

When do you expect that Session_End to run?

It will run when the session times out, which is by default 20 minutes
after the last page has been requested.

Hans Kesting


--
Ray Booysen
rj********@rjb. za.net
Mar 2 '06 #4
In addition to what Ray said, if you search the newsgroups you will find
hundreds of posts identical to yours, and responses to those posts that
explain all the various reasons why this cannot happen.

"Calvin Willman" <so*****@anon.c om> wrote in message
news:en******** ******@TK2MSFTN GP10.phx.gbl...
Thanks for your reply Hans,
I'm expecting it to run when the user closes the browser...

It's strange. I think it's working, but it's taking roughly 3 minutes for
the image to actually disappear from the folder. Also, the break point is
never encountered.

I've been testing including the <sessionState > element in the web.config
file in the Windows\Microso ft.Net\Config folder and I think it is that
which is making it work, rather than the application's web.config file.
Infact I'm pretty sure it's only working if I put it in the Windows
directory.

It's very annoying, as using Session_End was fine in VS 2003.

"Hans Kesting" <ne***********@ spamgourmet.com > wrote in message
news:mn******** *************** @spamgourmet.co m...
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 [SessionID].gif, and only want it to last as long as the
session, so I've included

File.Delete([filepath]) 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...

what's the problem??

Thanks in advance


When do you expect that Session_End to run?

It will run when the session times out, which is by default 20 minutes
after the last page has been requested.

Hans Kesting


Mar 2 '06 #5
The correct behavious only occurs if <sessionstate > element is in web.config
in Windows directory.

So... if I publish this to a remote site, I'm wondering if I'm going to have
problems as I won't have access to amend this file to make sure the correct
mode is in place on the webserver.

I'll have to think of something else... maybe sweep the folder to delete
files over a certain date.

The image is a proof of a business card, that a user will order or not... I
suppose I could set it to delete once the order is placed.

Thanks anyway for all your comments.

"Ray Booysen" <rj***********@ rjb.za.net> wrote in message
news:u%******** ********@TK2MSF TNGP11.phx.gbl. ..
You'll never get it to fire when the browser closes as IIS cannot know
when this happens. It fires when the session expires or is explicitly
closed.

I don't understand because you are seeing the correct behavior after 3
minutes. Isn't this what you want?

Regards
Ray

Calvin Willman wrote:
Thanks for your reply Hans,
I'm expecting it to run when the user closes the browser...

It's strange. I think it's working, but it's taking roughly 3 minutes for
the image to actually disappear from the folder. Also, the break point is
never encountered.

I've been testing including the <sessionState > element in the web.config
file in the Windows\Microso ft.Net\Config folder and I think it is that
which is making it work, rather than the application's web.config file.
Infact I'm pretty sure it's only working if I put it in the Windows
directory.

It's very annoying, as using Session_End was fine in VS 2003.

"Hans Kesting" <ne***********@ spamgourmet.com > wrote in message
news:mn******** *************** @spamgourmet.co m...
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 [SessionID].gif, and only want it to last as long as the
session, so I've included

File.Delete([filepath]) 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...

what's the problem??

Thanks in advance
When do you expect that Session_End to run?

It will run when the session times out, which is by default 20 minutes
after the last page has been requested.

Hans Kesting


--
Ray Booysen
rj********@rjb. za.net

Mar 2 '06 #6
Actually, that's not true... it works with the application web.config as
well, but it's just a little unpredicably..

I'm a little hungover today so that's probably not helping.

"Calvin Willman" <so*****@anon.c om> wrote in message
news:us******** ******@tk2msftn gp13.phx.gbl...
The correct behavious only occurs if <sessionstate > element is in
web.config in Windows directory.

So... if I publish this to a remote site, I'm wondering if I'm going to
have problems as I won't have access to amend this file to make sure the
correct mode is in place on the webserver.

I'll have to think of something else... maybe sweep the folder to delete
files over a certain date.

The image is a proof of a business card, that a user will order or not...
I suppose I could set it to delete once the order is placed.

Thanks anyway for all your comments.

"Ray Booysen" <rj***********@ rjb.za.net> wrote in message
news:u%******** ********@TK2MSF TNGP11.phx.gbl. ..
You'll never get it to fire when the browser closes as IIS cannot know
when this happens. It fires when the session expires or is explicitly
closed.

I don't understand because you are seeing the correct behavior after 3
minutes. Isn't this what you want?

Regards
Ray

Calvin Willman wrote:
Thanks for your reply Hans,
I'm expecting it to run when the user closes the browser...

It's strange. I think it's working, but it's taking roughly 3 minutes
for the image to actually disappear from the folder. Also, the break
point is never encountered.

I've been testing including the <sessionState > element in the web.config
file in the Windows\Microso ft.Net\Config folder and I think it is that
which is making it work, rather than the application's web.config file.
Infact I'm pretty sure it's only working if I put it in the Windows
directory.

It's very annoying, as using Session_End was fine in VS 2003.

"Hans Kesting" <ne***********@ spamgourmet.com > wrote in message
news:mn******** *************** @spamgourmet.co m...
> 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 [SessionID].gif, and only want it to last as long as the
> session, so I've included
>
> File.Delete([filepath]) 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...
>
> what's the problem??
>
> Thanks in advance
When do you expect that Session_End to run?

It will run when the session times out, which is by default 20 minutes
after the last page has been requested.

Hans Kesting

--
Ray Booysen
rj********@rjb. za.net


Mar 2 '06 #7

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

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();
5
2806
by: Steve M | last post by:
Why are my sessions lasting so long? I have them set to 20 minute timeout in config file? The Session_End event is getting called an hour or more sometimes--well after the user has stopped interacting with my site. Anyone have any insight? Thanks in advance
1
1711
by: Stig Johansen | last post by:
I have what I thought was a simple task. When the user's session times out I want to save some data to a database so that these can be retrieved the next time the user connects. I have therefore put this in the Session_End procedure of the global.asax.vb file. The problem is that nothing seems to happen. So either the Session_End is not firing or there is some issue with using the sqlclient at this time?
5
3464
by: JezB | last post by:
Why is my Session_End event in global.asax never firing ? I've tried fiddling with the timeouts but still nothing. Ideally I want to do some processing whenever someone leaves my web application (navigates somewhere else or closes the browser).
7
9287
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...
0
9671
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
9518
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
10000
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...
1
7538
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
6777
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
5560
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4112
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
3720
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2919
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.