Go Back   CodingForums.com > :: Server side development > ASP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 07-24-2002, 10:09 PM   PM User | #1
Tanker
New Coder

 
Join Date: Jun 2002
Location: Northern California
Posts: 50
Thanks: 2
Thanked 0 Times in 0 Posts
Tanker is an unknown quantity at this point
Server Variables....

Does anyone have a list of the variables from the web server and what I can use to read them with asp?

I need to be able to pick out things like what port the web server is running on.

I tried a couple of searches but didn't turn anything up. Thanks in advance.
Tanker is offline   Reply With Quote
Old 07-25-2002, 12:01 AM   PM User | #2
whammy
Senior Coder

 
Join Date: Jun 2002
Location: 41° 8' 52" N -95° 53' 31" W
Posts: 3,660
Thanks: 0
Thanked 0 Times in 0 Posts
whammy is an unknown quantity at this point
I have no idea if this is an exhaustive list, but here's the ones I have handy:

Request.ServerVariables("ALL_HTTP")
Request.ServerVariables("AUTH_PASS"
Request.ServerVariables("AUTH_TYPE")
Request.ServerVariables("CONTENT_LENGTH")
Request.ServerVariables("CONTENT_TYPE")
Request.ServerVariables("GATEWAY_INTERFACE")
Request.ServerVariables("HTTP_ACCEPT_LANGUAGE")
Request.ServerVariables("HTTP_ACCEPT")
Request.ServerVariables("HTTP_CONNECTION")
Request.ServerVariables("HTTP_USER_AGENT")
Request.ServerVariables("HTTP_COOKIE")
Request.ServerVariables("HTTP_REFERER")
Request.ServerVariables("LOGON_ACCEPT_ENCODING")
Request.ServerVariables("LOGON_USER")
Request.ServerVariables("PATH_INFO")
Request.ServerVariables("PATH_TRANSLATED")
Request.ServerVariables("QUERY_STRING")
Request.ServerVariables("REMOTE_ADDR")
Request.ServerVariables("REMOTE_HOST")
Request.ServerVariables("REMOTE_IDENT")
Request.ServerVariables("REMOTE_USER")
Request.ServerVariables("REQUEST_BODY")
Request.ServerVariables("REQUEST_METHOD")
Request.ServerVariables("SCRIPT_MAP")
Request.ServerVariables("SCRIPT_NAME")
Request.ServerVariables("SERVER_NAME")
Request.ServerVariables("SERVER_PORT")
Request.ServerVariables("SERVER_PORT_SECURE")
Request.ServerVariables("SERVER_PROTOCOL")
Request.ServerVariables("SERVER_SOFTWARE")
Request.ServerVariables("URL")
__________________
Former ASP Forum Moderator - I'm back!

If you can teach yourself how to learn, you can learn anything. ;)
whammy is offline   Reply With Quote
Old 07-25-2002, 06:44 AM   PM User | #3
glenngv
Supreme Master coder!


 
glenngv's Avatar
 
Join Date: Jun 2002
Location: Los Angeles, CA Original Location: Philippines
Posts: 10,241
Thanks: 0
Thanked 112 Times in 111 Posts
glenngv will become famous soon enough
shortcut and complete list version:

for each item in request.servervariables
response.write "<b>" & item & "</b> = " & request.servervariables(item) & "<br>"
next

Quote:
Originally posted by whammy
I have no idea if this is an exhaustive list, but here's the ones I have handy:

Request.ServerVariables("ALL_HTTP")
Request.ServerVariables("AUTH_PASS"
Request.ServerVariables("AUTH_TYPE")
Request.ServerVariables("CONTENT_LENGTH")
Request.ServerVariables("CONTENT_TYPE")
Request.ServerVariables("GATEWAY_INTERFACE")
Request.ServerVariables("HTTP_ACCEPT_LANGUAGE")
Request.ServerVariables("HTTP_ACCEPT")
Request.ServerVariables("HTTP_CONNECTION")
Request.ServerVariables("HTTP_USER_AGENT")
Request.ServerVariables("HTTP_COOKIE")
Request.ServerVariables("HTTP_REFERER")
Request.ServerVariables("LOGON_ACCEPT_ENCODING")
Request.ServerVariables("LOGON_USER")
Request.ServerVariables("PATH_INFO")
Request.ServerVariables("PATH_TRANSLATED")
Request.ServerVariables("QUERY_STRING")
Request.ServerVariables("REMOTE_ADDR")
Request.ServerVariables("REMOTE_HOST")
Request.ServerVariables("REMOTE_IDENT")
Request.ServerVariables("REMOTE_USER")
Request.ServerVariables("REQUEST_BODY")
Request.ServerVariables("REQUEST_METHOD")
Request.ServerVariables("SCRIPT_MAP")
Request.ServerVariables("SCRIPT_NAME")
Request.ServerVariables("SERVER_NAME")
Request.ServerVariables("SERVER_PORT")
Request.ServerVariables("SERVER_PORT_SECURE")
Request.ServerVariables("SERVER_PROTOCOL")
Request.ServerVariables("SERVER_SOFTWARE")
Request.ServerVariables("URL")
__________________
Glenn
_____________________________________________
Play Tower of Hanoi Android app (Ad-FREE!)
Play Tower of Hanoi Android app (FREE!)
Go to Tower of Hanoi Leaderboard
Play Tower of Hanoi Facebook app
glenngv is offline   Reply With Quote
Old 07-25-2002, 07:37 AM   PM User | #4
webmarkart
Regular Coder

 
Join Date: Jul 2002
Location: Raleigh, NC
Posts: 484
Thanks: 0
Thanked 0 Times in 0 Posts
webmarkart is an unknown quantity at this point
This site lists them and gives a description of what each one does... http://www.devguru.com/technologies/...variables.html
__________________
-WebMark Art
Programming is 80% thinking and 20% spelling
webmarkart is offline   Reply With Quote
Old 07-25-2002, 02:16 PM   PM User | #5
ReyN
New Coder

 
Join Date: Jun 2002
Location: Pilipinas
Posts: 89
Thanks: 0
Thanked 0 Times in 0 Posts
ReyN is an unknown quantity at this point
here's a demo that dynamically retrieves and displays the members of the thingy.

Enumerating the Request.ServerVariables Collection
__________________
aspxtreme
ReyN is offline   Reply With Quote
Old 07-25-2002, 11:38 PM   PM User | #6
whammy
Senior Coder

 
Join Date: Jun 2002
Location: 41° 8' 52" N -95° 53' 31" W
Posts: 3,660
Thanks: 0
Thanked 0 Times in 0 Posts
whammy is an unknown quantity at this point
Very good answers, all. I should have thought of looping through the Request.ServerVariables collection, myself!

This is probably a good enough thread to stick to the top of the ASP forum.
__________________
Former ASP Forum Moderator - I'm back!

If you can teach yourself how to learn, you can learn anything. ;)
whammy is offline   Reply With Quote
Old 07-26-2002, 05:01 AM   PM User | #7
Mhtml
Senior Coder

 
Mhtml's Avatar
 
Join Date: Jun 2002
Location: Sydney, Australia
Posts: 3,531
Thanks: 0
Thanked 1 Time in 1 Post
Mhtml is an unknown quantity at this point
Code:
<%
For Each Item in Request.ServerVariables
      Response.Write(Item & "<br />")
Next
%>
is that what the link was to?
__________________
Omnis mico antequam dominus Spookster!
Mhtml is offline   Reply With Quote
Old 07-26-2002, 06:47 PM   PM User | #8
ldiuf
New Coder

 
Join Date: Jun 2002
Posts: 64
Thanks: 0
Thanked 0 Times in 0 Posts
ldiuf is an unknown quantity at this point
Hey WebMarkart, or anyone

On that link you provided it had these variables...

Code:
Request.ServerVariables("HTTP_UA_PIXELS")	 - a string detailing the screen resolution of the user agent. 
 
Request.ServerVariables("HTTP_UA_COLOR")	 - a string with color information. 
 
Request.ServerVariables("HTTP_UA_OS")		 - a string stating the operating system of the user agent. 
 
Request.ServerVariables("HTTP_UA_CPU")		 - a string stating the processor type used by the user agent.
But they don't seem to work.
Does someone know how to get them to?

Cheers,
Larry
ldiuf is offline   Reply With Quote
Old 07-26-2002, 06:58 PM   PM User | #9
Tanker
New Coder

 
Join Date: Jun 2002
Location: Northern California
Posts: 50
Thanks: 2
Thanked 0 Times in 0 Posts
Tanker is an unknown quantity at this point
Thank you all for the great responses. Helped immensely. Here is my cheat sheet if anyone else is interested. As for the color/pixel thing I don't see those listed when looping through the server vars.

Code:
<table border="1" width="1024">
<%
For Each Item in Request.ServerVariables
      Response.Write("<tr><td noWrap>" & Item & "</td><td>" & Request.ServerVariables(Item) & "</tr>")
Next
%>
</table>
Thanks again...
Tanker is offline   Reply With Quote
Old 07-27-2002, 04:01 PM   PM User | #10
Morgoth
Senior Coder

 
Morgoth's Avatar
 
Join Date: Jun 2002
Location: Ontario, Canada Remaining Brain Cells: 6
Posts: 1,402
Thanks: 2
Thanked 1 Time in 1 Post
Morgoth is an unknown quantity at this point
Quote:
Originally posted by ldiuf
Hey WebMarkart, or anyone

On that link you provided it had these variables...

Code:
Request.ServerVariables("HTTP_UA_PIXELS")	 - a string detailing the screen resolution of the user agent. 
 
Request.ServerVariables("HTTP_UA_COLOR")	 - a string with color information. 
 
Request.ServerVariables("HTTP_UA_OS")		 - a string stating the operating system of the user agent. 
 
Request.ServerVariables("HTTP_UA_CPU")		 - a string stating the processor type used by the user agent.
But they don't seem to work.
Does someone know how to get them to?

Cheers,
Larry

I would also like to know.
Morgoth is offline   Reply With Quote
Old 07-29-2002, 04:18 PM   PM User | #11
Roy Sinclair
Senior Coder

 
Join Date: Jun 2002
Location: Wichita
Posts: 3,880
Thanks: 0
Thanked 0 Times in 0 Posts
Roy Sinclair will become famous soon enough
Quote:
Originally posted by ldiuf
Hey WebMarkart, or anyone

On that link you provided it had these variables...

Code:
Request.ServerVariables("HTTP_UA_PIXELS")	 - a string detailing the screen resolution of the user agent. 
 
Request.ServerVariables("HTTP_UA_COLOR")	 - a string with color information. 
 
Request.ServerVariables("HTTP_UA_OS")		 - a string stating the operating system of the user agent. 
 
Request.ServerVariables("HTTP_UA_CPU")		 - a string stating the processor type used by the user agent.
But they don't seem to work.
Does someone know how to get them to?

Cheers,
Larry
The key here is the letters "UA" in the middle of that list, that's short for User Agent and means those items will only show when the User Agent (ie the browser) provides those items. Checking with both IE 6 and Mozilla 1.0 none of those fields show up so it's probably safe to say you can't count on those fields.
Roy Sinclair is offline   Reply With Quote
Old 07-29-2002, 11:31 PM   PM User | #12
Morgoth
Senior Coder

 
Morgoth's Avatar
 
Join Date: Jun 2002
Location: Ontario, Canada Remaining Brain Cells: 6
Posts: 1,402
Thanks: 2
Thanked 1 Time in 1 Post
Morgoth is an unknown quantity at this point
Why would they exsist if IE6.0 (Microsoft made) wouldn't support it?

I know other browsers do, or might, but common!


Morgoth is offline   Reply With Quote
Old 07-30-2002, 06:37 PM   PM User | #13
Roy Sinclair
Senior Coder

 
Join Date: Jun 2002
Location: Wichita
Posts: 3,880
Thanks: 0
Thanked 0 Times in 0 Posts
Roy Sinclair will become famous soon enough
Quote:
Originally posted by Morgoth
Why would they exsist if IE6.0 (Microsoft made) wouldn't support it?

I know other browsers do, or might, but common!


From the look of things they may be something that someone only started to implement and got shot down or were implemented in an early version of IE but was subsequently dropped. I see those items documented in only 4 MS Knowledgebase articles all of which are very old (two are from 1997, they probably relate to IE 2.0!). I suspect those items fell into the category of "more than the server should know about the user" as privacy concerns have mounted since the potential privacy abuses on the web have grown more apparent.

That's all speculation of course, it would take someone with a lot more time and patience than I have to try to fathom the mind of a company like MS.
Roy Sinclair is offline   Reply With Quote
Old 07-31-2002, 01:21 PM   PM User | #14
Morgoth
Senior Coder

 
Morgoth's Avatar
 
Join Date: Jun 2002
Location: Ontario, Canada Remaining Brain Cells: 6
Posts: 1,402
Thanks: 2
Thanked 1 Time in 1 Post
Morgoth is an unknown quantity at this point
Quote:
Originally posted by Roy Sinclair
I suspect those items fell into the category of "more than the server should know about the user" as privacy concerns have mounted since the potential privacy abuses on the web have grown more apparent.
It could be because people could easily not allow people with a different OS then the webmaster allows. And other reasons for the others.
But all I would like to know is the amount of colour the user can see, and the size of his screen so I know If i should resize my graphics and tables or what not.
Erg. I can always do some of this in Javascript, but I don't really wanna mix languages. I don't have any Javascript of my site. I'm going for Style tags and ASP, and it's working fine.

less languages to learn means easier work for creating a site that looks nice and I understand. /
Morgoth is offline   Reply With Quote
Old 10-25-2005, 08:32 AM   PM User | #15
bigtiger
New Coder

 
bigtiger's Avatar
 
Join Date: Oct 2005
Posts: 98
Thanks: 0
Thanked 0 Times in 0 Posts
bigtiger is an unknown quantity at this point
Question

Quote:
Originally Posted by ReyN
here's a demo that dynamically retrieves and displays the members of the thingy.

Enumerating the Request.ServerVariables Collection
hi, Reyn,

this is a version with C#, is this will have a javascript version?
coz i'am writring script with javascript.
thanks

agp,
__________________

what ever you are, I will be there !!
[ pixy ] [ FrontPage] [ ThreeColumnLayouts] [ wellstyled ][ quirksmode.org ]
bigtiger is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 12:20 PM.


Advertisement
Log in to turn off these ads.