ASP Is Fun

Learning ASP
Free Course
Basics
Functions
SQL Commands
Sample Code


Servers / Setup
Host Reviews
Server Setup
Error Tips


Contract ASP
Development

Search For:


Intro to ASP


 
ASP Intro Ebook


System ServerRequest Variables



When your ASP script starts running, it has quite a number of system variables that help it perform tasks based on the browser the user is using, the type of computer they are running on, the language accepted, and much more. You can then customize your HTML so that it is just perfect for IE, or perfect for Netscape, or uses fonts for a Macintosh, and much more.

Here are some commmonly used server variables.

Variable NameFunction
HTTP_USER_AGENTBrowser the user is running
HTTP_UA_OSOperating system the user is running
HTTP_ACCEPT_LANGUAGELanguage the user wants
REMOTE_HOSTIP address of the user
GET_METHODGET or POST
HTTP_REFERERThe 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 "<link rel='stylesheet' href='/_css/windows/ie.css'>"
end if
if InStr(BrowserName, "MSIE") > 0 and InStr(BrowserName, "Win") = 0 then
Response.Write "<link rel='stylesheet' href='/_css/mac/ie.css'>"
end if
if InStr(BrowserName, "MSIE") = 0 and InStr(BrowserName, "Win") > 0 then
Response.Write "<link rel='stylesheet' href='/_css/windows/netscape.css'>"
end if
if InStr(BrowserName, "MSIE") = 0 and InStr(BrowserName, "Win") = 0 then
Response.Write "<link rel='stylesheet' href='/_css/mac/netscape.css'>"
end if

ASP Basic Concepts



Bookmark this site so you can reference it any time you have ASP questions in the future!




ASP Main Page | ASP Ebooks | Free ASP Course |
All content copyright © 2012 Minerva WebWorks LLC. All rights reserved.

Exploring Believability


Free Newsletter!

Ebooks
Intro to ASP
ASP SQL DB
Members
Shopping


Introduction to ASP

Thought Provoking
Video Games and Child Soldiers

Romance Tips
Irish Romance
Italian Romance
French Romance

ASP Poll
How do you handle 500 errors?
I don't
Page does nothing
Displays error
Emails error