When debugging errors with SharePoint 2007, you can have a hard time finding out what the actual error message is. SharePoint displays the “An unexpected error has occurred”, but this isn't helpful.
You can wade through the SharePoint log files and find the actual error message. This is time consuming and maybe tricky due to the amount of information written to the log.
You can modify the web.config so that you get the standard ASP.NET helpful error message. You will need to:
1. Backup the web.config.
2. Open the web.config in notepad and change
<SafeMode MaxControls="200" CallStack="false"
to
<SafeMode MaxControls="200" CallStack="true"
3. You will also need to change the CustomErrors mode to "Off"
<customErrors mode="Off"/>
4. Save changes.
5. Perform an IISRESET (cmd > type "IISRESET" and hit enter).
You will no longer see the “An unexpected error has occurred” error page. This helps during development, but during testing it's best to revert back to the SharePoint error pages so you can see how the production environment will look for an end user.
Hope this helps