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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T14:32:33+00:00 2026-05-20T14:32:33+00:00

whats the exact use of static variables in overall programming in .net and for

  • 0

whats the exact use of static variables in overall programming in .net and for asp.net…

Recently i went for the interview where interviewer asked me 2 question which i was not sure for the same..

  1. whats the use of session object, i said sessions are the server side object, they are used when you want to store user specific data at server side, then he asked what if i want to use static variables for the same, i was mum, can anyone tell me how asp.net will behave if i store the user specific information in static variables.

  2. If i use cookies which are the best option to store the data at client side (not sensitive one), but what if user has disabled cookies on his machine, will my application would crash, how i have to handle such exception…

  • 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-20T14:32:34+00:00Added an answer on May 20, 2026 at 2:32 pm

    1.) Session is a user specific dictionary(every user has it’s own) and static/shared variables are appclication wide(as long as the application runs/all sessions are not abandoned).

    Normally you would use Session if you want to store data that belongs to one user and static variables if you want to share it to all users.

    Therefore Session is less scalable than static variables because it increases with the number of users. One disadvantage of static variables(or the ASP.Net Cache) is that you have to avoid conflicts when different users access/change them parallel by yourself. Performance is one of the advantage of static variables/cache.

    So your anwer on Session was correct. If you want to use static variables for user specific data, you could use a static Dictionary with the User(f.e. the MembershipUser object or its providerkey as the key) and the data you want to store as the value. But normally you would use Session for this as you correctly asnwered.

    2.) Determine If a Browser Accepts Cookies

    The client can disable cookies. One way to check if cookies are disabled is to write a cookie to the Response and in the next Request to check if the cookie exists. If the cookie doesn’t exists you need to assume that cookies are disabled.

    Here are some further informations on cookies.

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

Sidebar

Related Questions

What is the exact use of Utilities.sleep() function? Should we use it between function
What Is the exact use of DSL? Is it worth time spending on reading
I know that Java doesn't really use exact pass by reference, but rather pass
Visual Studio shows the exact command line use to compiler and link a C++
I want use a Linq IQueryable Toolkit in project on .NET Compact Framework. The
The short question is - what is the best practice - to use or
Under what exact circumstances do @SessionAttributes get cleared? I've discovered some confusing behaviour when
Can someone explain to me what the exact meanings of the three JniHandleOwnership enum
To be more specific I do not know what the exact values will be.
What is the exact way of generating a Java code using WSDL in a

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.