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 6842259
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T00:04:40+00:00 2026-05-27T00:04:40+00:00

I have asp.net web site in which user can login and also do logout

  • 0

I have asp.net web site in which user can login and also do logout
Now i need to capture the total time duration for which user was logged-in to the site.
So to do this i need to know two things
1. Login time
2. Logout time

At the time of login i can get the first thing which is “Login time”, thats fairly easy
Now the second thing is more complicated. How do i update the Logout time? I know i can update it on the logout button but what if user directly close the browser?
I have setup the global.asax file but i dont think “Session_End” event will fire on closing the browser.
I have seen some of the website in which where you close the browser window it shows on dialog saying something like “press Ok to stay on the page OR press “Cancel” to stay on the current page”. I am thinking i can use the UpdatePanel’s PageMethods to do my task here. Is this possible? If yes then how?

Do you guys have any other idea to find out the total logged-in time for the user?

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. Editorial Team
    Editorial Team
    2026-05-27T00:04:41+00:00Added an answer on May 27, 2026 at 12:04 am

    I haven’t tried this but you can use the Window Close Event of the browser and make an ASP.net AJAX call to the server using AJAX page methods to end the Session, which you can catch in the Session_End event in global.asax file of your application.

    There are some problems with this approach as the Window close event is not 100% guaranteed to fire, because the user can simple end the process using task manager.

    Check https://stackoverflow.com/q/1824486/507184 for a jquery based solution for detecting browser close event

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

Sidebar

Related Questions

I have a Silverlight web app which uses ASP.net Website administration tool for user
I have an ASP.NET MVC web site. I have many actions which require authentication
I'm using VS2010,C# to develop an automation site (ASP.NET web app) which may have
I have an ASP.NET site on a public web server, where users login using
I have published an ASP.NET web site which targets ASP.NET 3.5 to a W
We have a non-SSL ASP.NET web app that allows a user to login (ASP
Some background. Currently have an asp.net web site which is contained on 2 web
I have an ASP.Net website which has a remember me feature for Login page.
I have deployed ASP.NET web site and ASP.NET web service on the same web
I have a site which is running in ASP.NET 4.0, on Windows 7 Ultimate.

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.