I have created HTTP handlers.
How do I create global variables for these handlers like I can with ASP.net web pages in global.asax?
I have created HTTP handlers.
How do I create global variables for these handlers like I can with ASP.net web pages in global.asax?
Add the variables to the Application instance:
System.Web.HttpContext.Current.Application["MyGlobalVariable"] = myValue;
Or, if the variable only need to live for the life of an individual request, use the Context object's Items collection:
System.Web.HttpContext.Current.Items["MyGlobalVariable"] = myValue;
Again, that will live for only the life of a single request.
If your handler is specified as reusable you can also use static class members.