Search Search

#1 worldwide
FREE Coding Lessons

since 1996
   THE BEST WAY to learn ASP & Asp.net!
Advertise Here!
click for details
Credits Host:
DiscountASP.net
Server Admin:
The "Team"
Contact Info.
Charles M. Carroll

my Blog
[prev. Lesson]  Loops: Intercepting Timeouts #3
     [next Lesson]  Server Variables: Domain/Host Name

Server Variables by Charles Carroll

Available Server Variables are the result of a combination of the browser software and the server software. They are not always exactly the same on your server and with specific browsers as we document here. Server Variables are retrieved with request.servervariables("variablename"), for example:

sn=request.servervariables("script_name") name of script, i.e./learn/server.asp in this case
ref=request.servervariables("http_referer") name of site page (unless they just typed the URL) they clicked on to get here.
br=request.servervariables("http_user_agent") Identification string emitted by browser.
lan=request.servervariables("http_accept_language") en for english. Basically indicates language the browser is targetted to.
user=request.servervariables("logon_user") IE passes back NT logon in this variable!

This script below demonstrates accessing a couple of these variables:
   filename=/learn/test/server.asp

<Test Script Below>


<html><head>
<title>server.asp</title></head>
<body>
<%
sn=request.servervariables("script_name")
response.write "Script Name=" & sn & "<br>"

ref=request.servervariables("http_referer")
response.write "Page thats links to this=" & ref & "<br>"

ua=request.servervariables("http_user_agent")
response.write "Browser String=" & ua & "<br>"

lan=request.servervariables("http_accept_language")
response.write "Browser Language=" & lan & "<br>"

user=request.servervariables("logon_user")
response.write "NT Logon Name=" & user & "<br>"
%>
</body></html>

There are many worthy charities!!. But perhaps help starving children in Africa or South America AND help Charles too. a $5 tip buys him lunch at McDonalds, a $20 tip buys his kid Hitoshi a new computer game, a $39 tip buys his daughter Michiko a few nice outfits. See our donor list.