Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP General > Tricky SERVER_NAME and HTTP_HOST return values?

Reply
Thread Tools

Tricky SERVER_NAME and HTTP_HOST return values?

 
 
Bill
Guest
Posts: n/a
 
      05-02-2007
These two server variables should ALWAYS return the domain name of the host:

- Request.ServerVariables("SERVER_NAME")
- Request.ServerVariables("HTTP_HOST")

Under what circumstances can those server variables return the server names of domains
that are completely unrelated to the hosting website???

I know, it's not supposed to work that way, but it is. I'm seeing almost 30,000
accesses/day on an empty website, no less!

For each entry, as a debugging mechanism I decided to log all the
Request.ServerVariables entries, and that's when I noticed the outrageous behavior of
the above two server variables.

How is this technically, possible???

(I should note that Request.ServerVariables("HTTP_REFERER") always returns the proper IP
address for the website. Also, I believe I know WHAT is causing this traffic, but to
prevent defensive answers on this group I don't want to mention that yet.)

THANKS!!!

Bill.



 
Reply With Quote
 
 
 
 
Anthony Jones
Guest
Posts: n/a
 
      05-03-2007

"Bill" <> wrote in message
news:...
> These two server variables should ALWAYS return the domain name of the

host:
>
> - Request.ServerVariables("SERVER_NAME")
> - Request.ServerVariables("HTTP_HOST")
>
> Under what circumstances can those server variables return the server

names of domains
> that are completely unrelated to the hosting website???
>
> I know, it's not supposed to work that way, but it is. I'm seeing almost

30,000
> accesses/day on an empty website, no less!
>
> For each entry, as a debugging mechanism I decided to log all the
> Request.ServerVariables entries, and that's when I noticed the outrageous

behavior of
> the above two server variables.
>
> How is this technically, possible???
>
> (I should note that Request.ServerVariables("HTTP_REFERER") always returns

the proper IP
> address for the website. Also, I believe I know WHAT is causing this

traffic, but to
> prevent defensive answers on this group I don't want to mention that yet.)
>
> THANKS!!!
>
> Bill.


In the case of server variables with the HTTP_ prefix these always contain
whatever text is in the Request header with a name matching the rest of the
variable name. All HTTP requests must contain a host: header, however, I'm
not sure what IIS would do it it were left blank.

HTTP_REFERER would therefore return the content of the referer header.
Typically a browser will supply this.

If the client agent added a request header PinkElephants it's value can be
retreived using HTTP_PINKELEPHANTS.

As to the SERVER_NAME I've never found it to return anything other that
whatever HTTP_HOST does regardless of what the documentation says it does.

IOW, the 'outrageous behavior' is likely caused by one of more clients
mis-behaving and is not the fault of server.





 
Reply With Quote
 
 
 
Reply

Thread Tools

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
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Request.ServerVariables("SERVER_NAME") is only returning IP E L ASP General 2 03-01-2007 03:00 AM
a tricky if else(maybe not tricky but impossible) nirkheys@gmail.com C Programming 9 04-25-2006 06:13 PM
Context.Request.ServerVariables("HTTP_HOST") returns always localhost Trapulo ASP .Net 2 09-08-2004 02:26 PM
Always 'localhost' from Request.ServerVariables["SERVER_NAME"] L Scott ASP .Net 1 08-31-2004 06:18 PM
Global asa and Request.ServerVariables("SERVER_NAME") martin de vroom ASP General 0 07-30-2003 05:02 AM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57