Are you really sure that you want every user of the site to share this state? This is quite a rare requirement. More likely it should be specific to the user.
There are few places in ASP.NET where you can save information:
- Application - global scope, so the value is visible to all users.
- Session - session scope, visible to one user
- Cache - global scope, so the value is visible to all users.
- TempData - visible to one user, during this and next request
Examples:
public ActionResult MyAction()
{
HttpContext.Application["global_var"] = "anyone can see me";
HttpContext.Cache["global_cached"] = "anyone can see me, but I can expire";
Session["session_var"] = "only this user can see me";
TempData["flash_var"]= "only this user can see me but also in next request";
}