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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T11:04:39+00:00 2026-05-29T11:04:39+00:00

the number of visitor will increase by click, but every time when i close

  • 0

the number of visitor will increase by click, but every time when i close my browser, the number of visitor never decreased

my testing step

1)click f5 on my browser, number of visitor increased by 1

2)open another browser ,number of visitor increased again, current number of visitor is 2

3)open 1 more browser, total number of visitor now is 3

4)closed 1 broweser, by right the number of visitor should decreased by 1

5)i clicked refresh on opened browser

6)the existed browser should total number of visitor =3

7)total number of visitor never decreased =(

     private static int member = 0;
     private static int visitor = 0;
void Application_Start(object sender, EventArgs e) 
{
    // Code that runs on application startup

    Application["Member"] = member;



   Application["Visitor"]=visitor;




}



void Session_Start(object sender, EventArgs e) 
{
    // Code that runs when a new session is started
    visitor += 1;
    Application.Lock();

    Application["Visitor"] = visitor;

    Application.UnLock();


}

   void Session_End(object sender, EventArgs e) 
{
    // Code that runs when a session ends. 
    // Note: The Session_End event is raised only when the sessionstate mode
    // is set to InProc in the Web.config file. If session mode is set to StateServer 
    // or SQLServer, the event is not raised.


    visitor -= 1;

    Application.Lock();

    Application["Visitor"] = visitor;

    Application.UnLock();




}
  • 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-29T11:04:40+00:00Added an answer on May 29, 2026 at 11:04 am

    Closing a browser window will not end a session, since no request is actually sent to the server when that happens. Sessions only end when a user has not had any activity on their session for whatever session timeout period you set.

    In theory, you could capture the window closing in javascript, then issue an AJAX request to a handler you’ve setup, and have that handler end the session. But that’s not the default behaviour, and frankly I don’t think it’s even desirable.

    Since you seem interested in maintaining a list of “active” users, you may just want to set the session timeout to be something very low (maybe 1 minute.)

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

Sidebar

Related Questions

I have a number input that should trigger jQuery on every change. To do
I have a large number of records (10,000, increasing every day) that essentially is
Using a PHP script I need to update a number every 5 seconds while
Is it possible to implement the Visitor Pattern respecting the Open/Closed Principle , but
I am building a report to identify the number of visitors that click on
Pandigital number is a number that contains the digits 1..number length. For example 123,
A number of team members update a central ASP.NET dev Website project, not a
A number of our users have just upgraded from IE6 to IE7. the upgreaded
A number of times I've argued that using clone() isn't such a bad practice.
The number 71867806 represents the present day , with the smallest unit of days

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.