Debugging MOSS 2007 Web Parts
Oh, I've had a heck of a time trying to debug some custom web parts that I've written for our internal portal application. I'm using Jan Tielens' SmartPart v3, which is an excelent webpart for hosting ASP.NET UserControls. (It even now supports ASP.NET AJAX!) But the problem that I've constantly run into with sharepoint is the dreaded "An unexpected error has occurred" issue. It gives no event logging, no trace logging, nothing. It's a dead end.
But thanks to Vincent Rothwell, I finally have an answer. He details the solution to this problem here, and the answer is to simply change a single attribute in your web.config:
<
SafeMode MaxControls=200 CallStack=false
to
<SafeMode MaxControls=200 CallStack=true
You will also need to set custom errors to 'Off' .
<customErrors mode=Off/>
This wouldn't be appropriate for a production portal, but for testing and debugging, it's a lifesaver. Thanks Vincent for this; you've saved me from a huge headache!