How to set custom error page in SharePoint 2013/2010

Place the custom error page at
"C:\Program Files\Common Files\microsoft shared\Web Server Extensions\15\

Code :- 

namespace UpdateErrorPage
   class Program
      static void Main(string[] args)
           using (SPSite site = new SPSite("http://siteUrl",SPUserToken.SystemAccount))
              SPWebApplication webApp = site.WebApplication;
              webApp.UpdateMappedPage(SPWebApplication.SPCustomPage.Error, "/_layouts/15/1033/customerror.html"); 

              //webApp.UpdateMappedPage(SPWebApplication.SPCustomPage.Error, null); //Reset Custom Error Page

              Console.Out.WriteLine("Press any key...");

Custom Error

This entry was posted in SharePoint and tagged , , , , , , , , , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s