Tricks for debugging Web Parts and Web pages in SharePoint
I decide to make this post as an ongoing one to record the tricks I come up with for debugging Web Parts and Web Part pages in ShaePoint.
1. Show call stack if exception occurs. Pages in SharePoint show "user friendly" messages when exception occurs. Often the messages are meaningless to developers. On the other hand the call stack on a normal aspx page upon exception is useful to determin where and what is wrong. So in the course of development, turn it on for SharePoint pages is a good choice.
How: find the tag <configuration><SharePoint><SafeMode>, set the attribute as CallStack="true"
2. Write in-line code block for easy debug. On an ASP.NET page, writing in-line code block is usually convenient especially with the full intellisense. After testing and debug, we can simply move the code block into the partial page class (code beside) and deploy it into GAC. However, SharePoint does now allow the code block on pages, unless we modify the web.config.
How: in tag <configuration><SharePoint><SafeMode><PageParserPaths>, add entry to allow the page contains code block, i.e. <PageParserPath VirtualPath="/list/matters/myitems.aspx" CompilationMode="Always" AllowServerSideScript="true" />
For details, see Serge's nice post.

This entry was posted
on Monday, May 14th, 2007 at 9:24 pm and is filed under Uncategorized.
You can follow any responses to this entry through the RSS 2.0 feed.
You can leave a response, or trackback from your own site.
Tricks for debugging Web Parts and Web pages in SharePoint
I decide to make this post as an ongoing one to record the tricks I come up with for debugging Web Parts and Web Part pages in ShaePoint.
1. Show call stack if exception occurs. Pages in SharePoint show "user friendly" messages when exception occurs. Often the messages are meaningless to developers. On the other hand the call stack on a normal aspx page upon exception is useful to determin where and what is wrong. So in the course of development, turn it on for SharePoint pages is a good choice.
How: find the tag <configuration><SharePoint><SafeMode>, set the attribute as CallStack="true"
2. Write in-line code block for easy debug. On an ASP.NET page, writing in-line code block is usually convenient especially with the full intellisense. After testing and debug, we can simply move the code block into the partial page class (code beside) and deploy it into GAC. However, SharePoint does now allow the code block on pages, unless we modify the web.config.
How: in tag <configuration><SharePoint><SafeMode><PageParserPaths>, add entry to allow the page contains code block, i.e. <PageParserPath VirtualPath="/list/matters/myitems.aspx" CompilationMode="Always" AllowServerSideScript="true" />
For details, see Serge's nice post.

This entry was posted
on Monday, May 14th, 2007 at 9:24 pm and is filed under Uncategorized.
You can follow any responses to this entry through the RSS 2.0 feed.
You can leave a response, or trackback from your own site.