Is it possible to edit the "httpErrors" in "system.webServer" section of a web.config file from code behind?
Im getting null value when using:
ConfigurationSection test = (ConfigurationSection)config.GetSection("system.webServer/httpErrors");
I would like to change the value of errorMode and existingResponse. Also remove any present "remove" or "error" declerations nested inside of "httpErrors".
From this:
<httpErrors errorMode="Custom" existingResponse="Replace">
<remove statusCode="404" />
<error statusCode="404" path="/ErrorPages/NotFound.aspx" />
</httpErrors>
To this:
<httpErrors errorMode="Detailed" existingResponse="Auto" />