Solved

Session_OnEnd() doesn't fire...?

Posted on 2004-08-28
4
421 Views
Last Modified: 2006-11-17
Hello,

I am currently trying to log the last "tab" a user was on as they exit the ASP.NET application.  My problem is that I can't seem to get the "Session_OnEnd()" sub procedure to fire in my Global.asax.vb page - unless I add "Handles MyBase.EndRequest" as the handler for that sub.  The down-side to doing that, is it updates the SQL tables when ever the user makes an HTTP request.  Which I do not want to happen since it's unnecessary trips to the db.  I only want it to fire if a true Session has ended.

Below is the exact code for that which does not fire.  Any help is very appreciated!

Sub Session_End(ByVal sender As Object, ByVal e As EventArgs)

    ' execute the stored proc and etc...

End Sub

This is what it looks like with the Handler "attached" to it....

Sub Session_End(ByVal sender As Object, ByVal e As EventArgs) Handles MyBase.EndRequest

    ' execute the stored proc and etc...

End Sub
0
Comment
Question by:DugArp
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 4

Expert Comment

by:Daniellus83
ID: 11920816
With the...


      Sub Session_End(ByVal sender As Object, ByVal e As EventArgs) Handles MyBase.EndRequest

          ' execute the stored proc and etc...

      End Sub

...can't you get from the e.{EventArgs_funtion} the detailed information...?
0
 
LVL 4

Accepted Solution

by:
Daniellus83 earned 125 total points
ID: 11921076
Sorry.. my post was very short,.. it comes to this (this is the best explaination I could find for you...):

(from MSDN; http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnaspp/html/aspnetsessionstate.asp)

"....The Session_OnEnd event signals the end of the session and is used to perform any clean-up code needed to terminate the session. Notice, though, that the event is supported only in InProc mode—that is, only when the session data is stored in the ASP.NET worker process. For Session_OnEnd to fire, the session state has to exist first, meaning that you have to store some data in the session state and must have completed at least one request..."

Use also this address to verify how you start/create a session... (You need one first to be anble to end one!)...

If you have any question, plz ask!
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

This article explains how to create and use a custom WaterMark textbox class.  The custom WaterMark textbox class allows you to set the WaterMark Background Color and WaterMark text at design time.   IMAGE OF WATERMARKS STEPS Create VB …
Introduction As chip makers focus on adding processor cores over increasing clock speed, developers need to utilize the features of modern CPUs.  One of the ways we can do this is by implementing parallel algorithms in our software.   One recent…
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …

749 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question