Reputation: 958
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?
Upvotes: 0
Views: 1898
Reputation: 144
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>
Upvotes: 3