Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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>
like image 360
Santosh Sahu Avatar asked Feb 12 '12 15:02

Santosh Sahu


People also ask

What is customErrors tag within a web config?

When customErrors is set to On or RemoteOnly, you need to specify the defaultRedirect attribute. This attribute contains the error page to which the user will be redirected. Additionally you can take custom error handling a step further by associating specific errors with specific error pages.

In which file the customErrors is specified?

config settings, customErrors can be configured within the Machine. config, root web. config or your application's web. config file.

What is custom error mode off?

In asp.net, we can find the exact error message by setting mode="Off" with in customErrors tag in web. config of our application. This is the way by which we can find out the exact error in our web application.


1 Answers

<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>
like image 62
Philip Rieck Avatar answered Sep 27 '22 21:09

Philip Rieck