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>
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.
config settings, customErrors can be configured within the Machine. config, root web. config or your application's web. config file.
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.
<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>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With