Reputation: 669
We can define application and session variables in ASP.NET MVC. If I have a web application hosted in server then in multi user environment how application and Session variables be treated with respect to every user who uses that website at the same time. Means application variable will start every time when request coming from multiple users? I just want to know what will happened to application and session variables in ASP.NET mvc in details.
Upvotes: 0
Views: 1287
Reputation: 1709
Session variables:
Application variables:
Upvotes: 0
Reputation: 2523
Session variables have an associated value for each different session on the server. This means that when a session dies, their variable values dissapear and reset when the user came again to a new session.
Application variables, on the other side, are common to all sessions in the server. It must be used responsibly, as modifying it's values affect the whole application globally.
When application is restarted on IIS (when you update your project, for example), session and application variables are restarted.
Upvotes: 3