Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 65289
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T18:55:23+00:00 2026-05-10T18:55:23+00:00

In ASP.NET, I’m looking for a way to audit a user leaving my application.

  • 0

In ASP.NET, I’m looking for a way to audit a user leaving my application. To be specific, I’d like to insert a ‘logout’ record in an audit table in SQL Server when the user’s session is abandoned/destroyed for any reason (not necessarily because of a call to session.abandon)

I have a ‘SessionHelper’ class that manages the session setters/getters.

I’ve tried posting back in Session_End in Global.asax, but it never fired this event even after the timeout expired.

I’ve tried overriding ‘finalize’ in the SessionHelper class and doing it there when the class is destroyed, but it did not fire that event either.

I’d try implementing IDisposable in the SessionHelper, but I don’t know where to call it so that it always gets called.

What is the proper way to audit a user leaving your ASP.NET application?

Thank you!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-10T18:55:24+00:00Added an answer on May 10, 2026 at 6:55 pm

    The Session_End event is only fired if you have InProc sessions. SQL or state server session management will not fire this event. If you can, get back to InProc sessions and use this event.

    Apart from that, you won’t get very good solutions. ASP.NET doesn’t offer a way to look at the current list of sessions on the server (at least, no way that users of StackOverflow know of, since I already asked the question), so you can’t use a job to check when they are destroyed.

    The next best thing would be to have a ‘last access time’ stored somewhere for your users and use that to detect a timeout of the session. The implementation of such a job is complicated though (you can miss logout events if a user logs in/out rapidly for example)…

    So no perfect solution here.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

(ASP.NET Web Application) I'd like to create a page which allows the user to
ASP.NET Application I am having some confusion with showing images. IE is fully working
ASP.Net 3.5 I want to create a user control that contains the ListView and
ASP.NET MVC 2 will support validation based on DataAnnotation attributes like this: public class
ASP.NET: How do you debug dynamically loaded user controls using LoadControl(string path);
ASP.NET / Mono MVC2 application is used to create and mail invoices, orders and
ASP.Net 4.5 introduces new ways to bind data to controls like the Repeater through
ASP.NET controls don't let you specify a table index to use when binding a
ASP.NET newbie here. I would like to create a form with multiple types of
ASP.NET MVC4 Beta introduced an easy way to create OData endpoints using WebAPI. So

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.