Displaying Debugging Info for SharePoint Errors in Your Browser

SharePoint does a good job of hiding errors from users.  Out of the box, unhandled errors in SharePoint result in a fairly non-descript page that says “An Error Occurred” (or something to that effect).  Although a good practice for your end-users, it’s pretty annoying when you’re trying to get a piece of code working or a configuration setting correct.  Here’s how you can display debugging information in your browser:

  • Find the following line in your web.config:

    <SafeMode MaxControls=”200″ CallStack=”false” DirectFileDependencies=”10″ TotalFileDependencies=”50″ AllowPageLevelTrace=”false”>

  • Change the CallStack attribute to true
  • Change the AllowPageLevelTrace to true
  • Find the following line in your web.config:

    <customErrors mode=”On” />

  • Change the mode to “Off”

The next time you have an error, it displays the familiar ASP.NET error information page with exception details and the callstack information.  Much less frustrating than a blasé error message.