Attempt to protect all aspx files in a folder protected by IP address

I like to protect all aspx files in the ~/Secure/secure folder , so certain IP addresses can access folders aspx. I added the following file web.configto the folder, hoping it would add 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 any of the aspx pages in a 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 needs to be done to make this idea happen? I like to just include one file web.configin a folder and this provides IP address authorization. I like this idea, as it is only code and code.

+4
source share
2 answers

You cannot do this only on the web.config website.

IIS: IIS, , , , IP- Restrinks .

" " "", (.. " " ).

.

+1

web.config location: -

<location path="Secure">
  <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>
</location>
0

Source: https://habr.com/ru/post/1537415/


All Articles