An array of C#, PHP, and HTML programming articles, tutorials, and resources

Posts Tagged ‘ servervariables ’

It’s common practice to store certain values in session variables to allow for easy access of data between page loads. This is known as a Server Variable in C#. Assume a server variable name of “foo“. It would be accessed as:

string myValue = Request.ServerVariables.Get("foo");

If you get the following error message: The name “Request” does not exist in the current context, try the following:

string myValue = System.Web.HttpContext.Current.Request.ServerVariables.Get("foo");