Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Session_OnEnd() doesn't fire...?

Posted on 2004-08-28
4
Medium Priority
?
424 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 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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

If you're writing a .NET application to connect to an Access .mdb database and use pre-existing queries that require parameters, you've come to the right place! Let's say the pre-existing query(qryCust) in Access takes a Date as a parameter and l…
Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Suggested Courses

636 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