Determine the URL hostname without using HttpContext.Current?

后端 未结 4 1682
孤独总比滥情好
孤独总比滥情好 2021-02-19 04:32

Using the current request I can get the URL hostname with:

HttpContext.Current.Request.Url.Host

But - I need to determine the URL hostname with

4条回答
  •  傲寒
    傲寒 (楼主)
    2021-02-19 05:12

    You should use the IIS api to query the information from the website you're looking for. Because depending on the IIS configuration your URL or Hostname could be differing. (Think about hostheaders, ports, protocols and stuff like this.

    A introduction for IIS API could be found at http://learn.iis.net/page.aspx/165/how-to-use-microsoftwebadministration/

提交回复
热议问题