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“);

This entry was posted on Friday, June 6th, 2008 at 7:05 am and is filed under C#. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

Leave a Reply