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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T11:51:01+00:00 2026-05-18T11:51:01+00:00

Possible Duplicate: ASP .NET Singleton I know the general differences between singleton class and

  • 0

Possible Duplicate:
ASP .NET Singleton

I know the general differences between singleton class and a class with static properties/methods but I would like to know how it influences the concurrency (many users logged in an application) in a ASP.NET MVC web application? For instance, we are storing settings in our singleton (or static properties) class. Is there a chance that two users suddenly start seeing/sharing the same settings? I mean, if one user changes his settings (being they are stored in memory for the runtime of the app), will it affect the other user? As far as I know the IIS creates one w3wp.exe process for an application, thus all users/visitors will be inside the same process, so could this have an effect on anything?

  • 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-18T11:51:02+00:00Added an answer on May 18, 2026 at 11:51 am

    Short answer, yes, the users will see the same value for any static property. It will be shared between the sessions.

    Long answer: yes and additionally if each session is attempting to update shared properties at the same time you can end up with undesired behavior, especially if the shared (static) property is a type that dynamically grows (any collection type). You’ll need to handle concurrency when accessing or modifying the values of shared properties.

    The only reason to have a singleton or static class is specifically to share one set of values/settings/configuration data with all connections. It keeps memory utilization low if all users need the same information. In this case you’d take care to initialize the values only once or update it atomically using a lock to ensure only one thread is changing the information at a time. Any number of threads could be reading the data without interfering with each other.

    If you need different values for different users, it’s better to use instance properties as you won’t need to worry about concurrence and the performance hit associated with locking.

    Static methods are fine. The only real difference between instance and static methods is the manner in which they are called. Even instance methods are held in memory in only one location. Only the instance properties are given their own memory space.

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

Sidebar

Related Questions

Possible Duplicate: asp.net membership IsApproved false but still allowing login i am having a
Possible Duplicate: ASP.NET “special” tags What is the difference between <%# ... %> ,
Possible Duplicate: Passing data between asp.net pages how to pass value of TEXTBOX from
Possible Duplicate: Where are static variables stored in asp.net aspx page Hi can someone
Possible Duplicate: ASP.NET: Web Site or Web Application? I have noticed that there is
Possible Duplicate: Using ASP.NET Controls without databinding My previous question yielded few results so
Possible Duplicate: Traditional ASP .NET vs MVC I am new to .net world coming
Possible Duplicate: Why does ASP.NET auto-generated .designer code have the incorrect type? On my
Possible Duplicate: How to prevent an ASP.NET application restarting when the web.config is modified?
Possible Duplicate: Client Id for Property (ASP.Net MVC) In my View I'm using jquery

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.