When error occurs in SharePoint, by default the following error message is displayed:

To see the "true" description of the ASP.NET errors along with the Stack and Page Output Trace messages, the following steps are required:
- In Windows Explorer, browse to the following folder: C:\inetpub\wwwroot\wss\VirtualDirectories\80
- Double-click the SharePoint web.config file.
- In the SharePoint web.config file, look for <customErrors mode="Off" /> tag and change it to <customErrors mode="On" /> - this enables the detailed ASP.NET errors to be shown to the remote clients and to the local host.
- You can also set the mode value to "RemoteOnly" so that the remote clients can see the Custom Error Message and the local host is shown with detailed ASP.NET errors.
- In the SharePoint web.config file, locate the <SafeMode MaxControls="200" CallStack="false" tag and change it to <SafeMode MaxControls="200" CallStack="true" - this enables you to received ASP.NET exception messages with stack trace information.
- Next, in the <system.web> element, add the following line <trace enabled="true" pageOutput="true"/> - this enables you to use the tracing feature in ASP.NET to monitor the page output and environment variables of the local host.
- Save and close the file.
You will no longer see the Sharepoint Custom Error Message page instead you get the "true" & "lovely" standard ASP.NET error page with the stack and page output trace as shown below:
SharePoint development has got that little bit easier!!.. I would recommend only making the following changes in a development environment and not production environment.