Solved

Session_OnEnd() doesn't fire...?

Posted on 2004-08-28
4
417 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
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

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

A while ago, I was working on a Windows Forms application and I needed a special label control with reflection (glass) effect to show some titles in a stylish way. I've always enjoyed working with graphics, but it's never too clever to re-invent …
Microsoft Reports are based on a report definition, which is an XML file that describes data and layout for the report, with a different extension. You can create a client-side report definition language (*.rdlc) file with Visual Studio, and build g…
This video discusses moving either the default database or any database to a new volume.
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

706 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now