Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Page 1 of 2 12 LastLast
Results 1 to 15 of 19
  1. #1
    New Coder
    Join Date
    Jun 2002
    Location
    Northern California
    Posts
    50
    Thanks
    2
    Thanked 0 Times in 0 Posts

    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.

  • #2
    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
    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. ;)

  • #3
    Supreme Master coder! glenngv's Avatar
    Join Date
    Jun 2002
    Location
    Philippines
    Posts
    11,047
    Thanks
    0
    Thanked 251 Times in 247 Posts
    shortcut and complete list version:

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

    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")

  • #4
    Regular Coder
    Join Date
    Jul 2002
    Location
    Raleigh, NC
    Posts
    484
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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

  • #5
    New Coder
    Join Date
    Jun 2002
    Location
    Pilipinas
    Posts
    89
    Thanks
    0
    Thanked 0 Times in 0 Posts
    here's a demo that dynamically retrieves and displays the members of the thingy.

    Enumerating the Request.ServerVariables Collection

  • #6
    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
    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. ;)

  • #7
    Senior Coder Mhtml's Avatar
    Join Date
    Jun 2002
    Location
    Sydney, Australia
    Posts
    3,531
    Thanks
    0
    Thanked 1 Time in 1 Post
    Code:
    <%
    For Each Item in Request.ServerVariables
          Response.Write(Item & "<br />")
    Next
    %>
    is that what the link was to?
    Omnis mico antequam dominus Spookster!

  • #8
    New Coder
    Join Date
    Jun 2002
    Posts
    64
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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

  • #9
    New Coder
    Join Date
    Jun 2002
    Location
    Northern California
    Posts
    50
    Thanks
    2
    Thanked 0 Times in 0 Posts
    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...

  • #10
    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
    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.

  • #11
    Senior Coder
    Join Date
    Jun 2002
    Location
    Wichita
    Posts
    3,880
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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.

  • #12
    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
    Why would they exsist if IE6.0 (Microsoft made) wouldn't support it?

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



  • #13
    Senior Coder
    Join Date
    Jun 2002
    Location
    Wichita
    Posts
    3,880
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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.

  • #14
    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
    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. /

  • #15
    New Coder bigtiger's Avatar
    Join Date
    Oct 2005
    Posts
    98
    Thanks
    0
    Thanked 0 Times in 0 Posts

    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,


  •  
    Page 1 of 2 12 LastLast

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •