Using Server Variables in ASP.NET

Category:
C#, VB.NET, ASP.NET
Type:
Snippets
Difficulty:
Beginning
Author:
Intelligent Solutions Inc.

Version Compatibility: ASP.NET

More information:
These are five functions that demonstrate how to access the ServerVariables collection in ASP.NET. The first outputs all the ServerVariables (key and value) to the browser; running this function will give you an idea of what's available to use. The 2nd allows you to request a Server Variable value by key name, the 3rd-5th demonstrate using user-defined function in case you are only interested in a few of these variables and want to hard code their names.

Instructions: Copy the declarations and code below and paste directly into your VB project.

Declarations:

Code: