Sunday, June 15, 2008

Getting Server and Other HTTP Information in a Class in an ASP.NET App

Another tidbit I can never remember when I need it. You're working on an ASP.NET website and you have a class that needs to access the Request or Response information, for example. Use HttpContext.Current as in the sample below.
_name = HttpContext.Current.Request.ServerVariables["SERVER_NAME"];

No comments: