2
<httpRuntime executionTimeout="600" maxRequestLength="11000" 
             requestLengthDiskThreshold="80"
             useFullyQualifiedRedirectUrl="false" 
             minFreeThreads="8" 
             minLocalRequestFreeThreads="4"
             appRequestQueueLimit="5000"
             enableKernelOutputCache="true"
             enableVersionHeader="true"
             requireRootedSaveAsPath="true" enable="true"
             shutdownTimeout="90" delayNotificationTimeout="5" 
             waitChangeNotification="0" maxWaitChangeNotification="0" 
             enableHeaderChecking="true" sendCacheControlHeader="true" 
             apartmentThreading="false"/>
  <trust level="Full"/>
  <customErrors mode="on" defaultRedirect="~/Contents/error.aspx">
  </customErrors>

This is my error handling in web.config which is not working.

If there is any exception thrown it doesn't redirect to /Contents/error.aspx page Is it because I set /Contents/error.aspx -

If not what's wrong with the error handling.

Amarnath Balasubramanian
  • 9,300
  • 8
  • 34
  • 62
user3239173
  • 89
  • 1
  • 3
  • 12
  • 3
    set `` to see the actual error.. – Sachin Feb 11 '14 at 07:32
  • If you're not trapping and displaying the error in your custom page, read the message. It's something like "To view the error details, set customErrors to off in your web.config". Set it to off. That'll show you what's wrong until you handle it properly in your custom error page. – Pierre-Luc Pineault Feb 11 '14 at 07:34
  • It is possible that your code is not compiling – rhughes Feb 11 '14 at 07:35
  • Im pretty sure in c# when using directories you have to use 2 '/' ... //Contents//error.aspx – bolt19 Feb 11 '14 at 07:43

3 Answers3

0

Have you configured the virtual directory as an ASP.NET application for the right framework version?

This error can be caused by a virtual directory not being configured as an application in IIS.

In IIS, you can have several applications, but they must be configured as an application. Generally, when you create a web project it maps directly to an IIS application.

Check with your hosting service on how to create an IIS application for your web app.

See IIS Setup

Take a look at here

Community
  • 1
  • 1
Vignesh Kumar A
  • 27,863
  • 13
  • 63
  • 115
0

Try using two '/' in the directory:

    //Contents//error.aspx

Hope this helps :)

bolt19
  • 1,963
  • 4
  • 32
  • 41
0

set customErrors mode="Off" in the web.config to see the actual error. As suggested by Sachin. It turned out to be a compilation Error I had to fix and could enable customErrors again.

IUnknown
  • 559
  • 6
  • 12