Session_End Not Firing

C

Chris Sibel

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 email that tells me what pages
the visited, how long they were on each page, etc. The second email is in
the Session_End Sub and the first is in the Session_Start. Now my question
is Why is it that the Session_End is never fired. I was forced to put the
code to send the second email on the logout.aspx page so when they click
logout then it sends it; THAT WORKS. But what happends when a user just
closes the browser window or goes to another site wihtout clicking logout.
Can someone tell me how I would fix this or why the Session_End is not being
fired at ALL. Thanks
 
S

Steve C. Orr MCSD

The session will time out after 20 minutes of no page
requests from the
user.
This default time interval is configurable in your
web.config file.
After the session times out the Session_End event will be
called in your
Global.asax file.
You can terminate the session manually by calling
Session.Abandon, but be
aware this will cause the Session_End event to not be
called. But that's
not so bad. Just take your code from the Session_End
event, put it in a
separate function, then call that function from both your
Session_End event
and whenever you call Session.Abandon.

Here's more details for you:
http://www.asp.net/Forums/ShowPost.aspx?
tabindex=1&PostID=7504
 
N

Naveen K Kohli

Session_End is not a very reliable place to put this kind of code. In Logout
page you can call Sessiob.Abandon. Then you will get the event. But if user
simply logs out, you will never get the event untill Session times out. The
approach you have right now, i.e. sending when LogOut button is clciked is
the only and recommended way to get it done.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Session_End() 1
Session_Start/Session_End 3
Session_End Qeustion? 5
Session_End 4
Session_End Event Always Firing 1
Session_End? 2
Session_End not firing 6
global.aspx and session_end event 8

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,053
Latest member
BrodieSola

Latest Threads

Top