Why does GetServerVariable(“HTTP_URL”) return different value depending on the pipeline mode

StackOverflow https://stackoverflow.com/questions/11470203

سؤال

In IIS, why does calling GetServerVariable("HTTP_URL") of the HttpWorkerRequest class result in different values depending on the pipeline mode?

When running under Integrated mode, it returns the raw url (that the server sees e.g, "/SomeUrl/Default.ashx").

While under Classic mode it seems like the value is the url that was typed into the browser (my url router maps for example /someurl to that specific handler).

هل كانت مفيدة؟

المحلول

Finally resolved this. Turns out we were doing a HttpContext.RewritePath which (I think) changes the result of GetServerVariable("HTTP_URL") under Integrated Mode. We replaced this by newing up the corresponding IHttpHandler and invoking it, instead of rewriting the path.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top