?
Solved

Session_OnEnd() doesn't fire...?

Posted on 2004-08-28
4
Medium Priority
?
426 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
  • 2
2 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 500 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

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

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

This tutorial demonstrates one way to create an application that runs without any Forms but still has a GUI presence via an Icon in the System Tray. The magic lies in Inheriting from the ApplicationContext Class and passing that to Application.Ru…
Since .Net 2.0, Visual Basic has made it easy to create a splash screen and set it via the "Splash Screen" drop down in the Project Properties.  A splash screen set in this manner is automatically created, displayed and closed by the framework itsel…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an anti-spam), the admin…
Is your OST file inaccessible, Need to transfer OST file from one computer to another? Want to convert OST file to PST? If the answer to any of the above question is yes, then look no further. With the help of Stellar OST to PST Converter, you can e…

807 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