Q: How do I display a more user-friendly error message?

Error messages are useful in debugging, but they're not exactly what you want your users to see when they access your application--here's how to display a different message.

Stefan Kowalewski, Tomek Stojeckiand 1 more

September 2, 2010

1 Min Read
ITPro Today logo

By Stefan Kowalewski, Tomek Stojecki, and Ethan Wilansky

Problem: SharePoint 2010 displays a standard “Server Error in ‘/’ Application” ASP.NET error message (Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code), such as what you see below:

This error message is quite useful when debugging applications in development. But it’s not the type of display you want to give the users of your SharePoint custom developed application.

Possible Solution: To display a more user-friendly message to the users, change the CallStack attribute of the SafeMode tag in web.config to false. (The code below can be fully read by sliding the horizontal scroll bar beneath it.)

CallStack="false" DirectFileDependencies="10" TotalFileDependencies="50" AllowPageLevelTrace="false">

The users will see the following error message:

See all the SharePoint Q&As:

Sharepoint Q&A: How Can I Create an External List When SharePoint Throws an Unspecfied ASP.NET Error?

Sharepoint Q&A: How Can I Create an Action for an External Content Type in SharePoint?

Sharepoint Q&A: How to Make a Type String Type Descriptor a Required Field in the BDC Explorer

Sharepoint Q&A: Data Source Conflict

Sign up for the ITPro Today newsletter
Stay on top of the IT universe with commentary, news analysis, how-to's, and tips delivered to your inbox daily.

You May Also Like