IIS / ASP.NET MVC:在特定的文件夹动态IP地址限制

编程入门 行业动态 更新时间:2024-10-14 06:23:54
本文介绍了IIS / ASP.NET MVC:在特定的文件夹动态IP地址限制的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

由于它是如何工作的,这将是微不足道使用的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地址限制

本文发布于:2023-11-02 00:23:32,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1550835.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:文件夹   地址   动态   在特定   ASP

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!