Return To Home Page
Server Variables
USAGE: Request.ServerVariables (variable)
Consult The Microsoft Documentation For A Full Description Of All The Server Variables Below.
|
Variable |
| ALL_HTTP |
| AUTH_TYPE |
| CONTENT_LENGTH |
| CONTENT_TYPE |
| GATEWAY_INTERFACE |
| HTTP_ACCEPT |
| HTTP_ACCEPT_LANGUAGE |
| HTTP_CONNECTION |
| HTTP_USER_AGENT |
| HTTP_COOKIE |
| HTTP_HOST |
| HTTP_COOKIE |
| LOGON_ACCEPT_ENCODING |
| PATH_INFO |
| PATH_TRANSLATED |
| QUERY_STRING |
| REMOTE_ADDR |
| REMOTE_IDENT |
| REMOTE_HOST |
| REQUEST_METHOD |
| SCRIPT_MAP |
| SCRIPT_NAME |
| SERVER_NAME |
| SERVER_PORT |
| SERVER_PORT_SECURE |
| SERVER_PROTOCOL |
| SERVER_SOFTWARE |
| URL | |
Here are two examples of what you could do with server variables.
HTTP_REFERER server variable can be used as a Dynamic Previous Page Hyperlink.
Paste this code into an asp file and you have an instant (Back Button). Or add a graphic if you wish.
<a href="<%= Request.ServerVariables("HTTP_REFERER") %>">Previous Page</a>
Previous Page
HTTP_USER_AGENT server variable can determine the client browser type
<%=Request.ServerVariables("HTTP_USER_AGENT")%>
Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322; .NET CLR 2.0.50727)
|
Regarding these Server Variables you can always loop through them as well and show all of them which is very helpful when testing.
<table border="1" width="500" style="border-collapse: collapse">
<%
For each item in Request.ServerVariables
Response.Write("<tr><td>" & item & "</td><td>")
Response.Write(Request.ServerVariables(item))
Response.Write("</td></tr>" & vbCrLf)
Next
%>
</table>
ASP
(Active Server Pages) is a technology developed by Microsoft. Pages using ASP
are primarily developed in JScript, or VBScript and are integrated into the
HTML of your Web pages. The ASP code is compiled on-the-fly by the server and
the resulting output is standard HTML. By using ASP, Web pages can be dynamic,
full of ever-changing content, and browser independent.