I like to secure all aspx files in a folder ~/Secure/
secure such that specific IP addresses can access the folder's aspx
files. I added the following web.config
file to the folder, hoping that it adds to the parent web.config
:
<configuration>
<system.webServer>
<security>
<ipSecurity allowUnlisted="false">
<clear/>
<add ipAddress="192.168.100.1" />
<add ipAddress="169.254.0.0" subnetMask="255.255.0.0" />
</ipSecurity>
</security>
</system.webServer>
</configuration>
The problem is that I get this error when I try to access to any of the aspx pages in the folder:
This configuration section cannot be used at this path. This happens when the section is locked at a parent level. Locking is either by default (overrideModeDefault="Deny"), or set explicitly by a location tag with overrideMode="Deny" or the legacy allowOverride="false"
.
What does it take to make this idea happen? I like to just include one web.config
file to a folder and that enforces the IP address authorization. I like this idea, since it is no-code and config only.