ASP.NET C# Static Variables are global?

Yes, in ASP.NET a static fields lifetime is for the app domain (note that this differs a bit for generic types).

I’d recommend using the server Session for storage of data you want to associate with an instance of a client browser session (user login).
i.e.

Session["_groupID"] = Convert.ToInt16(Request.QueryString["GroupID"]);

you can retrieve it by doing:

short groupID = Convert.ToInt16(Session["_groupID"]);

Leave a Comment