Sun
ONE Active Server Pages Product Home Page Developer Site Version
 

ContentsPreviousNextIndex



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:

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

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>


ContentsPreviousNextIndex