Can I fool HttpRequest.Current.Request.IsLocal?

前端 未结 4 1768
-上瘾入骨i
-上瘾入骨i 2021-02-08 07:44

I\'m running a web application that displays some debugging behavior if it\'s being run locally - quotes around resource strings, etc - and I\'d like to demo the application on

4条回答
  •  我在风中等你
    2021-02-08 08:31

    I believe this is true, but cannot verify right now.

    IsLocal returns True when the site is bound to the loopback address 127.0.0.1.

    If you make sure in IIS that your website is bound to one of your machine's non-loopback addresses (i.e. 192.168.1.100), then IsLocal should return False.

    Cassini, by definition, is always local, since it can only bind to the loopback address.

提交回复
热议问题