I have a great and important problem with Web.Config, I need to see the Error of my page and resolve it in asp.net web form and web config, but when Error Occurred, I see another error and I see this Message :
customErrors mode to Off or On Or RemoteOnly,
I set this property Off, but do not show error and say again please set attribute to On your CustomError.
when I set mode to On,say Please set customErrors mode to On Again.
To show the error for debugging and NOT showing an custom error page you do not need a
defaultRedirect
and simply having this should then output the debug / exception information:NOTE: Ensure that
On
starts with an upper-case O. By changing the web.config this should (by default) recycle your app pool and be picked up straight away.Set the mode to On, save the web.config then refresh or restart the IIS and make sure the mode is still set to On after saved. Browse to it again, it should show the error...
From what I can see, you don't have the
<customErrors mode="Off" />
as the first node in the<system.web>
node.If I were to guess, you have the customErrors node inside a
<compilation targetFramework="x.x">
node.You probably have the applicationpool set to another version of the .NET framework than the application is written in. Make sure the
<customErrors mode="Off" />
node is the first inside the<system.web>
node, then it will most likely give you the detailed errormessage.Here is sample code how you can display exceptions on custom page.
First create Default.aspx with button:
Add following code for button click event:
Second create ErrorPage.aspx with label:
And code for error page:
And finally place following configuration in web.config:
Compile and start with Default.aspx. Click your button and error will be shown on your custom page.
Happy coding!
removing this line works for me!
Make sure you nest the customErrors tag somewhere inside your
<system.web>
tag like this:From your description it's already likely it was placed there by you or automatically generated another way. Also try setting to On and restart the Application pool. You can do this by simply modifying
web.config
file by adding a break return or even just hit the space key, as long as you've made a change. Now re-upload making sure this is your second time with the customErrors mode was set to On. Hopefully you can now view your custom error page.If you are still having problems, and have access to your web site from IIS Manager try editing the .NET Error Pages in Features view. That will also do the same thing, providing your custom error page is in the correct directory for the
web.config
file to access.