go to the web.config of you web application (C:\inetpub\wwwroot\wss\VirtualDirectories\<Port Number>) and do the following:
change the call stack to true
change the custom Errors mode to Off
<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.