Sunday, December 28, 2008

Debug ASPX pages added to /LAYOUTS in SharePoint

How do you debug an ASPX page added to SharePoint's /LAYOUTS folder? There are many situations where you need to drop ASPX pages in the /LAYOUTs folder as part of a custom solution to some requriements. For example, an edit form for a custom content type, or a page for displaying data in a special way.

If the page fails, the exception is most likely logged in SharePoint log in the 12 hives, but wouldn't it be nice if you can step through the page in debug mode? All you need to do is to add the attribute debug="true" in the Page directive, set the breakpoint and attach the debugger to the process in Visual Studio, and voila!

Of course this is the standard way to debug ASP.NET pages. Only if you can remember it in the muddy water of SharePoint.

No comments: