Here are some commmonly used server variables.
Variable Name | Function |
HTTP_USER_AGENT | Browser the user is running |
HTTP_UA_OS | Operating system the user is running |
HTTP_ACCEPT_LANGUAGE | Language the user wants |
REMOTE_HOST | IP address of the user |
GET_METHOD | GET or POST |
HTTP_REFERER | The previous page the user came from |
For example, here is a block of code that writes out the appropriate stylesheet entry to the page based on which type of browser the user is running.
Dim ServerVar
Set ServerVar = Request.ServerVariables
BrowserName = ServerVar("HTTP_USER_AGENT")
OpSys = ServerVar("HTTP_UA_OS")
'SHOW STYLESHEET FOR MATCHING SYSTEM'
if InStr(BrowserName, "MSIE") > 0 and InStr(BrowserName, "Win") > 0 then
Response.Write ""
end if
if InStr(BrowserName, "MSIE") > 0 and InStr(BrowserName, "Win") = 0 then
Response.Write ""
end if
if InStr(BrowserName, "MSIE") = 0 and InStr(BrowserName, "Win") > 0 then
Response.Write ""
end if
if InStr(BrowserName, "MSIE") = 0 and InStr(BrowserName, "Win") = 0 then
Response.Write ""
end if
Introduction to ASP Ebook Download this ebook to get everything you need to know about learning ASP - from a step by step tutorial to function lists, sample code, common errors and solutions, and much more! 101 pages. |