简体   繁体   中英

Why is Request.ServerVariables[“HTTP_HOST”] different from Request.Url.Host?

Same server, same site - two different results.

Case 1

request URL: domain.com (resolving to domain.com/default.aspx)
request header in Firebug: domain.com
Request.ServerVariables["HTTP_HOST"] = domain.com
Request.Url.Host = domain.com (Ok, this is good and expected)

Case 2

request URL: domain.com/default.aspx
request header in Firebug: domain.com
Request.ServerVariables["HTTP_HOST"] = domain.com
Request.Url.Host = app5 (name of the server)

Looking at two requests I can't see anything that would cause that. Why would this be the case?
Server is running Windows 2003 and IIS6.

you should check whether the IIS metabase is setup to use the hostname or a different name

command -> cscript adsutil.vbs get W3SVC/SITE-ID/USEHOSTNAME

Result -> should be

The parameter "USEHOSTNAME" is not set at this node.

or USEHOSTNAME : (BOOLEAN) False

command -> cscript adsutil.vbs get W3SVC/SITE-ID/SETHOSTNAME

Result -> should be

The parameter "SETHOSTNAME" is not set at this node.

or SETHOSTNAME : (STRING) ""

change SITE-ID with the numeric id of the site.

If you see any other result that means somebody has modified the above two properties of the site.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM