I am sure most of the SharePoint developers would have come across the most common error page i.e. UnKnown Error Page while developing some custom web parts in SharePoint. In this post I am going to talk about 2 different ways to display exception details on the UnKnown Error Page.
Method 1: Turning the mode On/Off/RemoteOnly mode for the CustomErrors attribute in the web.config file. This is the most common way of displaying the exception details on the UnKnown error page.
Method 2: The other approach to catch this exception detail is by using this wonderful tool named Rapid-tools. There are 4 components in this tool which increase a developer’s productivity.
1. SPDeploy is a client side component that extends MSBuild to include targets that allow you to create a SharePoint solution file (.wsp) from a standard C# class library project inside Visual Studio. In addition, SPDeploy allows you to deploy your compiled wsp file to a remote SharePoint server. This allows you to develop locally and deploy to SharePoint remotely.
2. Provisioning Framework is set of APIs that allow you provision SharePoint assets including Site Collections, Sites, Pages and Files.
3. Exception Display is a component allows you to control the SharePoint’s unhandled exception behavior.
4. Data Cache allows you to cache data inside the SharePoint content database. This provides high performance data caching in web applications and also non-web applications, including SPtimer Jobs, stsadm command, WinForms applications and console applications.
The tool which I am going to use for displaying exception detail is Exception Display. You can download this tool from here. The installation is pretty simple just run the RapidTools-Server-Install.bat file in the server folder.
Enabling Exception Display
1. Exception display with minimal detail:
stsadm -o rapidtools-EnableExceptionDisplay -url siteurlhere
2. Exception display with the stack trace included:
stsadm -o rapidtools-EnableExceptionDisplay -url siteurlhere -printstack
3. Exception display with stack trace and http response terminated. In this case no UI is rendered, only the formatted exception is print to the http stream and the response is ended:
stsadm -o rapidtools-EnableExceptionDisplay -url siteurlhere -endresponse