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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T16:54:27+00:00 2026-06-09T16:54:27+00:00

I have about 10 Session variable for storing the File Download Counts of each

  • 0

I have about 10 Session variable for storing the File Download Counts of each different 10 Categories wise. I dont know why? but my session variable that is set into Global.asax get RESET automatically.

Since, the Machine is not restarted. Still the Counter of File Downloads get Reset. Any Idea? Plz Suggest me any solution.

In Global.asax:

 void Application_Start(object sender, EventArgs e) 
    {
        Application.Add("MGM",0);
        Application.Add("PC",0);
        Application.Add("NC",0);
        Application.Add("TC",0);
        Application.Add("PGC",0);
    }

    The *shortCode* parameter is name of Global Session from Global.asax file. that i am passing to get the counter and increment accordingly.
In Download.aspx.cs Page:

private int GetCount(string shordCode)
{
    int count=0;
    count = Convert.ToInt32(Application[shortCode]);
    lock (Application[shortCode])
    {
        Application[shortCode] = ++count;
    }

    return count;
}

Shall i store value in textfile and update accordingly after certain count say 500. if yes how to do? Our colleague says that if suppose many users downloading file and if both access the same value from textfile then cuncurency may occurs.I am Confused…!Help Appreciated.

  • 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-06-09T16:54:28+00:00Added an answer on June 9, 2026 at 4:54 pm

    Please refer to the MSDN page for ASP.NET Application State

    Excerpt:

    Because application state is stored in server memory, it
    is lost whenever the application is stopped or restarted. For example,
    if the Web.config file is changed, the application is restarted and
    all application state is lost unless application state values have
    been written to a non-volatile storage medium such as a database.

    By default, ASP.NET applications running on IIS will have their application pool shut down during periods of inactivity. I believe the default value for this is 20 minutes. Also by default, applications pools are recycled every 1740 minutes (29 hours).

    When this happens you will lose anything in the Application[] collection that you haven’t stored in a more permanent location, such as a database.

    Both of the above-mentioned values can be modified by right-clicking on the specific application pool in inetmgr and clicking on Advanced Properties to bring up the appropriate window.

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

Sidebar

Related Questions

I have read about storing session state out-of-process but still in memory by configuring
I have a about 10 application variable counters in Global.asax for displaying the file
I have read about session fixation and from what I understand it forces a
I have a question about session timeouts and JSF 2. I have my exception
I am reading about EJB Session Bean. I have worked mostly on spring and
A quick questions about sessions, I have a session with the following code <?php
i have about 60 fragments ListFragment , now i use each Listfragment with another
How would I go about setting a session variable from the click of an
I have a question regarding a session variable. I have session variable which needs
I have about 500 cd's that need backing up, they contain old sessions. I

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.