I need to server parts of my application from different domains. To be precise I have a sub section of the site that should be served from a region specific domain. For example:
I'd like to make a route entry that will redirect the request with wrong domain to the correct domain. But I don't know how to access http header information form HttpContext.
Any help is welcome.
I think you want Request.Headers["host"]
string requestedDomain = HttpContext.Current.Request.ServerVariables["HTTP_HOST"];
string requestScheme = HttpContext.Current.Request.Url.Scheme;
string requestQueryString = HttpContext.Current.Request.ServerVariables["QUERY_STRING"];
string requestUrl = HttpContext.Current.Request.ServerVariables["URL"];
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With