SharePoint Display custom error Message in Errorpage

Normally the SharePoint errors are filled with messages that no user will understand followed by a correlation id. Well, the user knows there is an error, but what should he do next? It would be nice to give him some advice like try to refresh the page or anything. Therefore the SPUtility provides a nice solution. With TransferToErrorPage you can simply bring your own text into an error message. This is useful if you develop some features or custom pages or anything custom.

SPUtility.TransferToErrorPage(string.Format("Error loading List Form Page: {0}\r\n\r\nStack Trace:\r\n{1}", ex.Message, ex.StackTrace));


SPUtility.TransferToErrorPage("Dear User, there was an error. We apologize for that. Please refresh the page and try again.");

The result of the error message is like this:


Looks better right?

But keep in mind: In this case there will be nothing added to ULS no logging entry is made. So you have to add it by yourself.


The article or information provided here represents completely my own personal view & thought. It is recommended to test the content or scripts of the site in the lab, before making use in the production environment & use it completely at your own risk. The articles, scripts, suggestions or tricks published on the site are provided AS-IS with no warranties or guarantees and confers no rights.

Karsten Schneider
About Karsten Schneider 302 Articles
He is Consultant for SharePoint Solutions for collaboration, communication and business processes. He provides his customers applications based on standard features as well as development or combining the power of several microsoft tools like Dynamics CRM. In his free time he tries to collect tipps and worthy experience in this blog.

Be the first to comment

Leave a Reply

Your email address will not be published.