How to get “Host:” header from HttpContext (asp.net)

后端 未结 3 2044
时光取名叫无心
时光取名叫无心 2020-12-06 05:54

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 exam

3条回答
  •  伪装坚强ぢ
    2020-12-06 06:43

    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"];
    

提交回复
热议问题