Home > ASP.NET > IIS Server Variables

IIS Server Variables

IIS server variables provide information about the server, the connection with the client, and the current request on the connection.

IIS server variables are not the same as environment variables.

Paste the code given below in your asp.net web page [HTML Design] to see the information associated for each of the iis server variables.

<%Response.Write(HttpContext.Current.Request.ServerVariables["ALL_HTTP"]);%>
<%Response.Write(HttpContext.Current.Request.ServerVariables["ALL_RAW"]);%>
<%Response.Write(HttpContext.Current.Request.ServerVariables["APPL_MD_PATH"]);%>
<%Response.Write(HttpContext.Current.Request.ServerVariables["AUTH_TYPE"]);%>
<%Response.Write(HttpContext.Current.Request.ServerVariables["AUTH_PASSWORD"]);%>
<%Response.Write(HttpContext.Current.Request.ServerVariables["AUTH_USER"]);%>
<%Response.Write(HttpContext.Current.Request.ServerVariables["CERT_COOKIE"]);%>
<%Response.Write(HttpContext.Current.Request.ServerVariables["CERT_FLAGS"]);%>
<%Response.Write(HttpContext.Current.Request.ServerVariables["CERT_ISSUER"]);%>
<%Response.Write(HttpContext.Current.Request.ServerVariables["CERT_KEYSIZE"]);%>
<%Response.Write(HttpContext.Current.Request.ServerVariables["CERT_SECRETKEYSIZE"]);%>
<%Response.Write(HttpContext.Current.Request.ServerVariables["CERT_SERIALNUMBER"]); %>
<%Response.Write(HttpContext.Current.Request.ServerVariables["CERT_SERVER_ISSUER"]);%>
<%Response.Write(HttpContext.Current.Request.ServerVariables["CERT_SERVER_SUBJECT"]);%>
<%Response.Write(HttpContext.Current.Request.ServerVariables["CONTENT_LENGTH"]);%>
<%Response.Write(HttpContext.Current.Request.ServerVariables["CONTENT_TYPE"]);%>
<%Response.Write(HttpContext.Current.Request.ServerVariables["GATEWAY_INTERFACE"]);%>
<%Response.Write(HttpContext.Current.Request.ServerVariables["HTTPS"]);%>
<%Response.Write(HttpContext.Current.Request.ServerVariables["HTTPS_KEYSIZE"]);%>
<%Response.Write(HttpContext.Current.Request.ServerVariables["HTTPS_SECRETKEYSIZE"]);%>
<%Response.Write(HttpContext.Current.Request.ServerVariables["HTTPS_SERVER_ISSUER"]);%>
<%Response.Write(HttpContext.Current.Request.ServerVariables["HTTPS_SERVER_SUBJECT"]);%>
<%Response.Write(HttpContext.Current.Request.ServerVariables["INSTANCE_ID"]);%>
<%Response.Write(HttpContext.Current.Request.ServerVariables["INSTANCE_META_PATH"]);%>
<%Response.Write(HttpContext.Current.Request.ServerVariables["LOCAL_ADDR"]);%>
<%Response.Write(HttpContext.Current.Request.ServerVariables["LOGON_USER"]);%>
<%Response.Write(HttpContext.Current.Request.ServerVariables["PATH_INFO"]);%>
<%Response.Write(HttpContext.Current.Request.ServerVariables["PATH_TRANSLATED"]);%>
<%Response.Write(HttpContext.Current.Request.ServerVariables["QUERY_STRING"]);%>
<%Response.Write(HttpContext.Current.Request.ServerVariables["REMOTE_ADDR"]);%>
<%Response.Write(HttpContext.Current.Request.ServerVariables["REMOTE_HOST"]);%>
<%Response.Write(HttpContext.Current.Request.ServerVariables["REQUEST_METHOD"]);%>
<%Response.Write(HttpContext.Current.Request.ServerVariables["SCRIPT_MAP"]);%>
<%Response.Write(HttpContext.Current.Request.ServerVariables["SCRIPT_NAME"]);%>
<%Response.Write(HttpContext.Current.Request.ServerVariables["SERVER_NAME"]);%>
<%Response.Write(HttpContext.Current.Request.ServerVariables["SERVER_PORT"]);%>
<%Response.Write(HttpContext.Current.Request.ServerVariables["SERVER_PORT_SECURE"]);%>
<%Response.Write(HttpContext.Current.Request.ServerVariables["SERVER_PROTOCOL"]);%>
<%Response.Write(HttpContext.Current.Request.ServerVariables["SERVER_SOFTWARE"]);%>
<%Response.Write(HttpContext.Current.Request.ServerVariables["URL"]);%>
<%Response.Write(HttpContext.Current.Request.ServerVariables["HTTP_ACCEPT"]);%>
<%Response.Write(HttpContext.Current.Request.ServerVariables["HTTP_ACCEPT_LANGUAGE"]);%>
<%Response.Write(HttpContext.Current.Request.ServerVariables["HTTP_CONNECTION"]);%>
<%Response.Write(HttpContext.Current.Request.ServerVariables["HTTP_HOST"]);%>
<%Response.Write(HttpContext.Current.Request.ServerVariables["HTTP_REFERER"]);%>
<%Response.Write(HttpContext.Current.Request.ServerVariables["HTTP_USER_AGENT"]);%>
<%Response.Write(HttpContext.Current.Request.ServerVariables["HTTP_COOKIE"]);%>
<%Response.Write(HttpContext.Current.Request.ServerVariables["HTTP_UA_CPU "]);%>
<%Response.Write(HttpContext.Current.Request.ServerVariables["HTTP_ACCEPT_ENCODING"]);%>

References: http://msdn.microsoft.com/en-us/library/ms524602.aspx

Advertisements
  1. December 3, 2009 at 3:06 AM

    Thank you,
    very interesting article

  2. December 12, 2009 at 1:12 AM

    I really enjoyed reading this article, keep up creating such exciting articles.

  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: