Santosh Sahu
Santosh Sahu

Reputation: 219

The configuration section 'customErrors' cannot be read because it is missing a section declaration

I have uploaded my webpage to a server.

My webpage is working fine in the local system. But when I upload it to the server it is showing the error

The configuration section 'customErrors' cannot be read because it is missing a section declaration.

I have tried all the possibility but still i am getting the above error. Can anyone suggest what should I change in my config file to resolve the issue?

My Webconfig File:

<configuration>
    <configSections>
        <section name="neatUpload" type="Brettle.Web.NeatUpload.ConfigSectionHandler, Brettle.Web.NeatUpload" allowLocation="true" />
        <sectionGroup name="modulesSection">
            <section name="rewriteModule" type="RewriteModule.RewriteModuleSectionHandler, RewriteModule" />
        </sectionGroup>
    </configSections>
    <!-- <customErrors mode="ON" /> -->
    <!--  <customErrors mode="Off" />  -->
    <customErrors mode="ON" defaultRedirect="GenericErrorPage.html">
         <!--   <error statusCode="403" redirect="NoAccess.htm" />
            <error statusCode="404" redirect="FileNotFound.htm" /> -->
    </customErrors>
    <modulesSection>
        <rewriteModule>
            <rewriteOn>true</rewriteOn>
            <rewriteRules>
            <rule source="http://[^/]*/*(\w+[&amp;-]*\w+)/*((\w+[&amp;-]*\w+)(\s)*)*/*((\w+[&amp;-]*\w+)(\s)*)*$" destination="landPage.aspx?CampaginName=$1&amp;SubDomain=$2&amp;UserName=$3&amp;PageName=$4" />
            <!-- <rule source=".*" destination="landPage.aspx?CampaginName=$1&amp;UserName=$2"/>-->
            </rewriteRules>
        </rewriteModule>
    </modulesSection>

Upvotes: 12

Views: 21528

Answers (1)

Philip Rieck
Philip Rieck

Reputation: 32568

<CustomErrors> goes under <system.web> You have yours under <configuration> directly. That is, the parent element of your customErrors tag is configuration, which is incorrect. Checking MSDN on customErrors will show you the correct structure to add it to your config file.

<configuration>
    <!-- your other stuff -->
    <system.web>
        <customErrors mode="ON" defaultRedirect="GenericErrorPage.html">
             <!--   <error statusCode="403" redirect="NoAccess.htm" />
            <error statusCode="404" redirect="FileNotFound.htm" /> -->
        </customErrors>
    </system.web>
</configuration>

Upvotes: 21

Related Questions