Reputation: 219
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+[&-]*\w+)/*((\w+[&-]*\w+)(\s)*)*/*((\w+[&-]*\w+)(\s)*)*$" destination="landPage.aspx?CampaginName=$1&SubDomain=$2&UserName=$3&PageName=$4" />
<!-- <rule source=".*" destination="landPage.aspx?CampaginName=$1&UserName=$2"/>-->
</rewriteRules>
</rewriteModule>
</modulesSection>
Upvotes: 12
Views: 21528
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