Add variables to the application instance:
System.Web.HttpContext.Current.Application["MyGlobalVariable"] = myValue;
Or, if the variable should live only for the life of a single request, use the collection of objects of the context object:
System.Web.HttpContext.Current.Items["MyGlobalVariable"] = myValue;
Again, this will only live for the life of a single request.
source
share