Note: This article was originally published in 2011. Some steps, commands, or software versions may have changed. Check the current .Net documentation for the latest information.
Prerequisites
Before you begin, make sure you have:
- Visual Studio or .NET CLI installed
- .NET Framework or .NET Core SDK
- Basic C# programming knowledge
Unfortunately custom errors is a setting that lives at the SharePoint site level, not at the ‘application page / _layouts’ level, so you will have to edit the web.config that applies to the entire SharePoint site which is located at: C:inetpubwwwrootwssVirtualDirectories Once there you’ll have to enable 3 different settings that should already be there for it to work:
- CustomErrors = ”Off” instead of the default which is ‘On’
- Debug=”true”. I keep hearing this might be set to false but in my case it shows true
- CallStack=”true”. Again, another value that is there for me by default but might not be in your setup.
Now remember that before making any chances you want to back up your web.config. It is a very long and delicate file and if you mess something up by accident rolling back your chances might be very hard. In my case all I had to do is is go to the _layouts web.config and change the following line:
Server Error in ’/’ Application.
--------------------------------------------------------------------------------
Runtime Error
Description: An application error occurred on the server. The current custom error settings for this application prevent the details of the application error from being viewed.
Details: To enable the details of this specific error message to be viewable on the local server machine, please create a tag within a “web.config” configuration file located in the root directory of the current web application. This tag should then have its “mode” attribute set to “RemoteOnly”. To enable the details to be viewable on remote machines, please set “mode” to “Off”.
<system.web>
</system.web>
Notes: The current error page you are seeing can be replaced by a custom error page by modifying the “defaultRedirect” attribute of the application’s configuration tag to point to a custom error page URL.
<system.web>
</system.web>
Summary
You’ve successfully learned turn off custom errors for debugging mode in sharepoint 2010 application pages. If you run into any issues, double-check the prerequisites and ensure your .Net environment is properly configured.
Related Articles
- How to enable Session in a SharePoint 2010 Application page?
- How to make your Telerik controls work on a Custom SharePoint 2010 web application
- Telerik - The base class includes the field {}, but its type {} (Telerik.Web.UI.RadGrid) is not compatible with the type of control (Telerik.Web.UI.RadGrid).
- Enumeration: What are the different SharePoint permission levels and their enumeration values?