Search This Blog


Debugging WSS Components

Under normal conditions, WSS provides error messages intended for end users in a production environment. This means that WSS doesn’t automatically provide rich diagnostic information or helpful error messages to assist you when you are debugging your code. While you are developing WSS components such as custom application pages, you must modify the web.config file for the current Web application to enable debugging support and error messages that contain stack traces. Here’s a fragment of the web.config file that shows the three important attributes that have been changed from their default values to enable rich debugging support.

<SafeMode CallStack="true" />
<customErrors mode="Off" />
<compilation debug="true" />
While it is essential to modify the web.config file as shown here to enable debugging support, you will also find it occasionally necessary to return the web.config file to its original state. For example, you might create an application page that throws an exception or an event handler that cancels a user’s actions. By returning the web.config file to its original state, you can see how your code will actually behave in a production environment. Therefore, you should become comfortable with the act of changing the web.config file back and forth between debugging mode and standard end user mode.

No comments: