Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to add security section in web.config to external file

I need block a huge IP list via config file

<security>
      <ipSecurity allowUnlisted="true">
        <clear />          
        <add ipAddress="1.0.1.0" subnetMask="255.255.255.0" />
        <add ipAddress="1.0.2.0" subnetMask="255.255.254.0" />
        <add ipAddress="1.0.8.0" subnetMask="255.255.248.0" />
        <add ipAddress="1.0.32.0" subnetMask="255.255.224.0" />
        ...
      </ipSecurity>
</security>

Is it possible to add security section in web.config to external file ?

like image 738
Arbejdsglæde Avatar asked Dec 14 '25 05:12

Arbejdsglæde


1 Answers

c:\Windows\system32\inetsrv\config\applicationHost.config

change the configuration for the web server:

from:

< section name="ipSecurity" overrideModeDefault="Deny" / > 

to:

< section name="ipSecurity" overrideModeDefault="Allow" / > 

and your web.config

< configuration > 
< system.webServer > 
< security > 
< ipSecurity configSource="fileWithIps.config" / > 
< /security > 
< /system.webServer > 
< /configuration > 
like image 59
free4ride Avatar answered Dec 16 '25 21:12

free4ride



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!