Is it possible to configure a location in Web.config to only allow local connections

后端 未结 5 698
余生分开走
余生分开走 2020-11-30 08:57

I\'ve got a page in an ASP.Net app (its Mvc actually but not important) and I would like to only allow connections to this page from the local machine. I would love to do s

5条回答
  •  余生分开走
    2020-11-30 09:25

    1. Invent a non-DNS alias for the machine, i.e. "PrivateHostName".
    2. Set this value in the local hosts file to point to 127.0.0.1.
    3. Set a (IIS) host header for the web site such that it only responds to requests to address "PrivateHostName".
    4. For all local calls use the private host name.

    Remote clients will not be able to resolve the host name.

    You could secure it more using a dedicated ip address tied to a virtual network adapter which would not actually respond to external requests.

提交回复
热议问题