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

  • SEARCH
  • Home
  • 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 MVC2 application controller performs some action and redirects to grid page after
ASP.NET Ajax Library provides some client-side events. For instance: Sys.Application.add_load( function(args) { // handle
ASP .NET MVC 1 I'd like to show a partial view base on a
ASP.NET newbie here. When on a page I'd like to set the corresponding menu
Asp.net membership 2.0. I want to update the username in table aspnet_user, the best
ASP.NET and C#. I'd like to have a CheckboxList with a Select All item.
ASP.NET has the ability to detect potentially dangerous input from the client. I'd like
ASP.NET controls like ListView allows providing a custom template by setting the ListView.EmptyDataTemplate property,
ASP.NET, C# I was doing something like this. Just need to complete it somehow.

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.