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

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

Hide comments


  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.