Search code examples
iisweb-configmsdeployiis-8appcmd

Command to remove web.config entry


I am using below command to add an entry in Web.config

C:\Windows\System32\inetsrv>appcmd set config "MarketWorkFlowWebApp" section:system.webServer/security/requestFiltering /allowDoubleEscaping:false

Output :

Applied configuration changes to section "system.webServer/security/requestFiltering" for "MACHINE/WEBROOT/APPHOST/MarketWorkFlowWebApp" at configuration commit
 path "MACHINE/WEBROOT/APPHOST/MarketWorkFlowWebApp"

Adding settings is working fine.

To remove the above entry i am using below command

 C:\Windows\System32\inetsrv>appcmd set config "MarketWorkFlowWebApp" -section:system.webServer/security/requestFiltering

OutPut:

Applied configuration changes to section "system.webServer/security/requestFiltering" for "MACHINE/WEBROOT/APPHOST/MarketWorkFlowWebApp" at configuration commit
     path "MACHINE/WEBROOT/APPHOST/MarketWorkFlowWebApp"

But web.config still contains those entries.

So how can remove any existing tags from web.config.


Solution

  • This works for me:

    appcmd.exe set config "Default Web Site/" -section:system.webServer/security/requestFiltering /allowDoubleEscaping:"True"
    

    And then to celar it...

    appcmd.exe clear config "Default Web Site/" -section:system.webServer/security/requestFiltering /allowDoubleEscaping