?
Solved

Session_OnEnd() doesn't fire...?

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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

I think the Typed DataTable and Typed DataSet are very good options when working with data, but I don't like auto-generated code. First, I create an Abstract Class for my DataTables Common Code.  This class Inherits from DataTable. Also, it can …
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Suggested Courses
Course of the Month8 days, 2 hours left to enroll

765 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