In ASP.Net, you can create the equivalent of global variables using the Cache object.
Cache["someName"] = "some value";
One of the benefits of using a cache is that you can put objects into it.
Another advantage is that you can change the value in the code.
You can also use the Application object, but Cache is preferred because of memory management.
As always, you should avoid overuse of these global variables and minimize their size.
source share