由于它是如何工作的,这将是微不足道使用的WebForms做的,但我看不到一个合乎逻辑的方式使用MVC做到这一点。我有我的应用程序(公共API),我想它应用特定的动态IP限制的一部分(所以我需要有一个仅适用于应用程序的某些部分Web.config文件)。在的WebForms,我只需创建一个文件夹,并把Web.config文件中与它相关的限制。有没有办法用MVC做到这一点?
Because of how it works, this would be trivial to do using WebForms, but I can't see a logical way to do it using MVC. I've a part of my application (the public API) that I'd like to apply specific Dynamic IP Restrictions on it (so I need to have a Web.config file that applies only to some part of the app). In WebForms, I'd simply create a folder and put a Web.config file in it with the associated restrictions. Is there a way to do this with MVC?
推荐答案元素的位置仍然可以使用MVC应用配置(如IP限制)到你的MVC应用程序的某些部分:
Location elements can still be used in MVC to apply configuration (like IP restrictions) to certain parts of your MVC app:
<location path="secret/api"> <system.webServer> <security> <ipSecurity allowUnlisted="false"> <clear/> <add ipAddress="127.0.0.1"/> </ipSecurity> </security> </system.webServer> </location>更多推荐
IIS / ASP.NET MVC:在特定的文件夹动态IP地址限制
发布评论