Request.ServerVariables Question

W

W. Loo

Hi,

I've got a question regarding the usage of Request.ServerVariables.
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.ServerVariables("ALL_HTTP"). Additionally, when I iterate
through Request.ServerVariables using a "For Each key in
Request.ServerVariables" the key of "Test" comes up. However, when I
use Request.ServerVariables("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.ServerVariables("Test") comes up empty
when I can plainly see there is a value in the "ALL_HTTP" dump?

Thanks in advance!
 
C

Chris Hohmann

W. Loo said:
Hi,

I've got a question regarding the usage of Request.ServerVariables.
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.ServerVariables("ALL_HTTP"). Additionally, when I iterate
through Request.ServerVariables using a "For Each key in
Request.ServerVariables" the key of "Test" comes up. However, when I
use Request.ServerVariables("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.ServerVariables("Test") comes up empty
when I can plainly see there is a value in the "ALL_HTTP" dump?

Thanks in advance!

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

Request.ServerVariables("HTTP_Test")

Here's a link to the documentation for the ServerVariables collection
http://msdn.microsoft.com/library/en-us/iisref/htm/ref_vbom_reqocsv.asp

HTH
-Chris Hohmann
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,774
Messages
2,569,598
Members
45,144
Latest member
KetoBaseReviews
Top