473,385 Members | 1,676 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,385 software developers and data experts.

session_end when triggerd?

gce
Hi,

Every session I make a temp directory using Session("SessieGuid") =
System.Guid.NewGuid().ToString
Whenever the user presses a button to end everything or when the
session.timeout fires up, I need to remove the directory.

My question :

1. What command is needed behind the END-button to close the session
2. And when will session_end will fire up?

Best regards,
gert
Nov 19 '05 #1
5 1455
To end the session, I think the best practice is to call

Session.Clear();
Session.Abandon();

in that order.

if you do this, the Session_End event will be called immediately (in the
same thread I think). Otherwise it will be called when the user's session is
timed out, which depends on the <sessionState timeout="..." > in
web.config.

AFAIK, this only works with <sessionState mode="InProc"> which is the
default.

Andy
"gce" <gc****@hotmail.com> wrote in message
news:d2**********@news1.zwoll1.ov.home.nl...
Hi,

Every session I make a temp directory using Session("SessieGuid") =
System.Guid.NewGuid().ToString
Whenever the user presses a button to end everything or when the
session.timeout fires up, I need to remove the directory.

My question :

1. What command is needed behind the END-button to close the session
2. And when will session_end will fire up?

Best regards,
gert

Nov 19 '05 #2
Session_end occurs twenty minutes (by default) after having no news from the
user.You can use Session.Abandon to force this.

Traditionaly this is not considered always reliable (not sure it will fire
if ASP.NET is recycled) (note also that the SQL Server session provider
doesn't fire AFAIK this event).

My personal preference is to have my housekeeping tasks kept independant
from the application control flow. For example here you could kill those
dirs one day later or even I would try to see if I really need those
dirs...(you could name files using those GUIDs, you could make them not
available on the Internet if this is the case for this scheme etc...)

Patrice

--

"gce" <gc****@hotmail.com> a écrit dans le message de
news:d2**********@news1.zwoll1.ov.home.nl...
Hi,

Every session I make a temp directory using Session("SessieGuid") =
System.Guid.NewGuid().ToString
Whenever the user presses a button to end everything or when the
session.timeout fires up, I need to remove the directory.

My question :

1. What command is needed behind the END-button to close the session
2. And when will session_end will fire up?

Best regards,
gert

Nov 19 '05 #3
Explicit call to Session.Abandon will end the session and lets End event to
be raised (which happens when SessionStateModule gets the response for
postprocessing), but this happens only in InProc session mode.

--
Teemu Keiski
ASP.NET MVP, AspInsider
Finland, EU

"gce" <gc****@hotmail.com> wrote in message
news:d2**********@news1.zwoll1.ov.home.nl...
Hi,

Every session I make a temp directory using Session("SessieGuid") =
System.Guid.NewGuid().ToString
Whenever the user presses a button to end everything or when the
session.timeout fires up, I need to remove the directory.

My question :

1. What command is needed behind the END-button to close the session
2. And when will session_end will fire up?

Best regards,
gert

Nov 19 '05 #4
gce
I am a relative newbie and an old fashion vb6 programmer so forgive me
stupid questions.

I run it on a testserver in vmware locally. In web.config the INPROC is set.
The session.timer is set to 1 in the session_start part op global.

I made a button with :

session.clear
session.abandon

but the statements that are in session_end won't fire up.

Other options are not there for me. The site is hosted externally and I can
not do scheduled things there i think.
Nov 19 '05 #5
It looks like you're doing the right thing.

If you're just going straight in and clicking the end button it may be that
you do not actually have a session. I'm not 100% sure about this but it's
possible you need to do a round-trip to the browser to properly establish a
session i.e. make sure you put something in the session when the page is
originally displayed.

if it's not that, try waiting until the session is timed out and see if the
session_end is fired then. This will tell you whether sessions_end is
working

as Patrice said, you should not rely 100% on this mechanism anyway. What I
do in this situation is put some code into application_start to clear down
all the directories for all users. Use this in conjunction with the
session_end.

Andy

"gce" <gc****@hotmail.com> wrote in message
news:d2**********@news5.zwoll1.ov.home.nl...
I am a relative newbie and an old fashion vb6 programmer so forgive me
stupid questions.

I run it on a testserver in vmware locally. In web.config the INPROC is
set. The session.timer is set to 1 in the session_start part op global.

I made a button with :

session.clear
session.abandon

but the statements that are in session_end won't fire up.

Other options are not there for me. The site is hosted externally and I
can not do scheduled things there i think.

Nov 19 '05 #6

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

Similar topics

2
by: Chris Sibel | last post by:
Hey guys I have a user tracking setup to track users. What it does is once a user hits my site it sends me an email telling me some info and once a user clicks the logout button it sends a second...
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; ...
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...
7
by: Henry | last post by:
I have a question on session_end. I'm trying to log into my database when the session times out, it will store user info into a table. When I got step into a line where I was trying to open...
11
by: OldProgrammer | last post by:
All the documentation and discussion I have read indicate that the Session_End is not supposed to fire unless you are in "inProc" Session state mode, and then only on Session Timeout or at Session...
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....
1
by: =?Utf-8?B?YnJlbnQ5NjA=?= | last post by:
Environment: ASP.NET 2.0, SQL Server 2005, C#, Visual Studio 2005 In my Session_End event, I am executing a stored procedure to update a database table that is used to log user sessions. When...
12
by: =?Utf-8?B?QWxleCBNYWdoZW4=?= | last post by:
Hi. I am trying to maintain a list of people who are currently "online" in SQL. I do this by adding a simple entry to a simple PeopleOnline table whenever someone logs in to my site. If they...
5
by: Ron J | last post by:
I would like to keep track of users when they are 'on'. On Session_Start I can write a DB record about them, but there does not seem to be session variable information during the Session_end event...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
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
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...

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.