How to implement debug option in SharePoint 2007 (MOSS/WSS) Application within VS 2005 with complete call stack instead of custom error page

Here are the steps to implement debug option in your SharePoint Application:

 

1. Browse to the set of virtual directories for Windows SharePoint Services. Just remember, you cannot access the web.config file via your web browser as security restrictions set by IIS.

 

For example, c:\Inetpub\wwwroot\wss\VirtualDirectories.

 

For each virtual directory

Open the web.config file contained in the virtual directory.

Change the line <compilation batch=”false” debug=”false“> to <compilation batch=”false” debug=”true“>.

 

2. To obtain the complete call stack instead of the default error page, you can alter the web.config file: set the CallStack value to true in the SharePoint section:

<SafeMode MaxControls="200" CallStack="true"/>

 

3. Additionally make sure the CustomeErrors mode value (in the system.web section) is set to Off:

<customErrors mode=”Off”>

 

4. Open a command prompt and type iisreset to restart the server.

 

Found the idea from following 2 articles:

 

How to Enable ASP.NET Debugging Web Parts and SharePoint Solutions

http://www.sharepointblogs.com/MainFeed.aspx