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

后端 未结 2 1452
無奈伤痛
無奈伤痛 2021-01-06 14:56

I need block a huge IP list via config file


      
                  
        

        
相关标签:
2条回答
  • 2021-01-06 15:33

    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 > 
    
    0 讨论(0)
  • 2021-01-06 15:37

    There are multiple ways you could achieve this, but for a start I would look at the ConfigurationManager's ConfigurationManager.OpenMappedExeConfiguration method for mapping a secondary config file

    0 讨论(0)
提交回复
热议问题