I am trying to add custon 404 pages as per answer of this question
ASP.NET MVC 404 handling and IIS7 <httpErrors>
by adding
<httpErrors existingResponse="PassThrough" />
under <system.webServer>
tag in my Web.Config file.
But I am getting following error
Module: CustomErrorModule
Notification: SendResponse
Handler: System.Web.Mvc.MvcHandler
Error Code: 0x80070021
Config Error: 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".
Config Source
153: <httpErrors existingResponse="PassThrough" />
154: </system.webServer>
I also tried to override the locking based on http://learn.iis.net/page.aspx/145/how-to-use-locking-in-iis-70-configuration ( Task 2 )
by adding location tag in the Web.config
as following
<configuration>
....
....
<location allowOverride="true">
<system.webServer>
<httpErrors existingResponse="PassThrough" />
</system.webServer>
</location>
</configuration>
but I am getting the same error.
How should I configure httpErrors element in Web.config so it works
I am using IIS 7 , VS 2010 , ASP.NET MVC3
Update:
I am able to get rid of the locked error
if i modify applicationHost.config file and change
this
<section name="httpErrors" overrideModeDefault="Deny" />
to
<section name="httpErrors" overrideModeDefault="Allow" />
but ideally I do not want to change applicationHost.config file and want to override it from the Web.config file