Sometimes debugging SharePoint errors is not the easiest of tasks. The most common and annoying situation is when the "An unexpected error has occurred" error message is shown and nothing is written to both the trace log files (check my previous post on Diagnostic Logging for more information on this) and Event Viewer. In order for the real error message to be shown, two settings must be changed in the web.config file:
- <SafeMode MaxControls="200" CallStack="false"… /> must be changed to <SafeMode MaxControls="200" CallStack="true" … />
- The customError setting must be changed to "Off":
<customErrors mode="Off"/>
After these changes, the "An unexpected error has occurred" will no longer be shown and you will see the real error message in a standard ASP.NET error page, including all the debugging information you need.