Debugging SharePoint 2010 _layout pages and turn off custom errors.


To debug SharePoint site you need to configure the Web.Config of the web application, usually found at c:\inetpub\wwwroot\wss\virtualdirectories\<name and port number of Web Application>.

Search and find the line of code.

 <compliation batch="false" debug="false">

And change into

 <compliation batch="false" debug="true">

 

Search and find the line of code.

<SafeMode MaxControls="200" CallStack="false"...>

And change into

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

Search and find the line of code.

<customErrors mode="On"/>

And change into

<customErrors mode="Off"/>



Once you have saved your web.config file you can easily debug and get the default error messages of webparts, pages etc. However you may notice that all _layouts pages still give you a custom errors, or a hybrid of trying to give you proper error message and a custom error.

_Layout pages have their own web.config file which requires you to change the customErrors mode to Off. This web.config can be found at the following location;

C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\TEMPLATE\LAYOUTS\Web.config

Now when you encounter an error on the layout pages you will now get a true error message.

Advertisements