ONE Active Server Pages Product Home Page Developer Site Version


Examples: Request Object ServerVariables Collection

An iterator can be used to loop through each server variable name. For example, the following script prints all server variables in a table:

<TR><TH>Server Variable</TH><TH>Value</TH></TR>
<% for each name in Request.ServerVariables %>
   <TD><%= name %></TD>
   <TD><%= Request.ServerVariables(name) %></TD>
<% Next %>

The following example demonstrates using Request.ServerVariables to insert the name of a server into a hyperlink:

<A HREF="http://<%= Request.ServerVariables("SERVER_NAME")%>
   /scripts/MyPage.asp">Link to MyPage.asp</A>