0

Is there any way to intercept SharePoint error messages in IIS?

For example, when I type this url: https://mywebsite.com/~.aspx, SharePoint answers with its own error page that says:

Sorry, something went wrong The file or folder name contains characters that are not permitted. Please use a different name.

I would like to intercep this error message (and all SharePoint error messages) and redirect to my own custom error page.

Please note that:

  1. When SharePoint shows this error in its own error page, the url remains the same (https://mywebsite.com/~.aspx)
  2. When I inspect the page (F12) in the Network tab (using Chrome) the response is 200 OK, so no SharePoint is not reporting the error number back.

I expect to be able to somehow configure IIS in order to intercept any SharePoint errors and then show a custom made page instead of showing the standard and internal SharePoint error pages.

  • Unfortunately that's not possible. If a web app (SharePoint) decides to return an error page as a 200 HTTP response, then any web server (IIS, nginx and etc) won't easily allow you to intervene. – Lex Li Oct 26 '22 at 16:16
  • I agree with the suggestion given by Lex Li. Generally, 200 response means a good page that has no issue. IIS do not have a way to intercept it. If we see your sample URL is contains `~`.If your actual URL contains the `~` then if it is possible, you could modify the URL may help to avoid the issue. – Deepak-MSFT Oct 28 '22 at 08:45

0 Answers0