Reveal Unknown Error on Sharepoint 2007 pages

How
often you have encountered the infamous Unknown Error on Sharepoint
2007 pages. If you are a Sharepoint developer, chances are that
innumerable times :)

However,
if you are also seasoned ASP.NET developer as well, you also know the
trick behind it to reveal them., which I am going to give it here.

The
trick is that ASP.NET Framework wants to show the real error message,
but its the sharepoint which abstracts the message from the user. This
is good for production systems since those cryptic error message may
not be user friendly. Or revealing those full stack trace could cause
potential security concerns.

But
for an experienced developer, this is almost must to turn them off.
This is achieved by turning off custom errors in web.config

Find the web.config for the site you normally use as your development site. Locate this tag

<SafeMode ... CallStack="false" ...> and change it to CallStack="true"

Set <customErrors mode="On" /> to mode="Off"

Set <compilation batch="false" debug="false"> to <compilation batch="true" debug="true">

Now you will get the full stack trace as soon as the error is raised.