Request.ServerVariables Question

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • W. Loo

    Request.ServerVariables Question

    Hi,

    I've got a question regarding the usage of Request.ServerV ariables.
    I'm not sure this is really a ASP question, so redirects to a more
    appropriate newsgroup are welcome.

    I have a variable that is being passed to me through HTTP headers
    called "Test." I am able to see this variable and its value when I use
    Request.ServerV ariables("ALL_H TTP"). Additionally, when I iterate
    through Request.ServerV ariables using a "For Each key in
    Request.ServerV ariables" the key of "Test" comes up. However, when I
    use Request.ServerV ariables("Test" ), the value returned to me is
    always empty. One workaround thats been suggested by the person
    sending me the header is to simply parse the contents of "ALL_HTTP" to
    retrieve the data I want. This is doable, but I'm curious to know why
    exactly the value of Request.ServerV ariables("Test" ) comes up empty
    when I can plainly see there is a value in the "ALL_HTTP" dump?

    Thanks in advance!
  • Aaron Bertrand - MVP

    #2
    Re: Request.ServerV ariables Question

    The ALL_HTTP info is news to me, but this should answer why there isn't a
    custom header:






    "W. Loo" <wlo023@hotmail .com> wrote in message
    news:33c69d4e.0 311171408.3ac18 c39@posting.goo gle.com...[color=blue]
    > Hi,
    >
    > I've got a question regarding the usage of Request.ServerV ariables.
    > I'm not sure this is really a ASP question, so redirects to a more
    > appropriate newsgroup are welcome.
    >
    > I have a variable that is being passed to me through HTTP headers
    > called "Test." I am able to see this variable and its value when I use
    > Request.ServerV ariables("ALL_H TTP"). Additionally, when I iterate
    > through Request.ServerV ariables using a "For Each key in
    > Request.ServerV ariables" the key of "Test" comes up. However, when I
    > use Request.ServerV ariables("Test" ), the value returned to me is
    > always empty. One workaround thats been suggested by the person
    > sending me the header is to simply parse the contents of "ALL_HTTP" to
    > retrieve the data I want. This is doable, but I'm curious to know why
    > exactly the value of Request.ServerV ariables("Test" ) comes up empty
    > when I can plainly see there is a value in the "ALL_HTTP" dump?
    >
    > Thanks in advance![/color]


    Comment

    • Chris Hohmann

      #3
      Re: Request.ServerV ariables Question

      "W. Loo" <wlo023@hotmail .com> wrote in message
      news:33c69d4e.0 311171408.3ac18 c39@posting.goo gle.com...[color=blue]
      > Hi,
      >
      > I've got a question regarding the usage of Request.ServerV ariables.
      > I'm not sure this is really a ASP question, so redirects to a more
      > appropriate newsgroup are welcome.
      >
      > I have a variable that is being passed to me through HTTP headers
      > called "Test." I am able to see this variable and its value when I use
      > Request.ServerV ariables("ALL_H TTP"). Additionally, when I iterate
      > through Request.ServerV ariables using a "For Each key in
      > Request.ServerV ariables" the key of "Test" comes up. However, when I
      > use Request.ServerV ariables("Test" ), the value returned to me is
      > always empty. One workaround thats been suggested by the person
      > sending me the header is to simply parse the contents of "ALL_HTTP" to
      > retrieve the data I want. This is doable, but I'm curious to know why
      > exactly the value of Request.ServerV ariables("Test" ) comes up empty
      > when I can plainly see there is a value in the "ALL_HTTP" dump?
      >
      > Thanks in advance![/color]

      Any variables not natively enumerated into the ServerVariables
      collection should be accessed by prefixing with "HTTP_" or "HEADER_". In
      your case:

      Request.ServerV ariables("HTTP_ Test")

      Here's a link to the documentation for the ServerVariables collection
      Learn with interactive lessons and technical documentation, earn professional development hours and certifications, and connect with the community.


      HTH
      -Chris Hohmann


      Comment

      Working...