IIS 7 and Above
Configuration & Scripting
Custom error page configuration on IIS 8
Re: Custom error page configuration on IIS 8
Oct 23, 2018 05:35 AM|Brando Zhang|LINK
If you host an asp.net application, I suggest you could directly use C# codes to throw 403 exception.
Codes as below:
throw new HttpException(403, "This is a '403' test");
But ASP.Net application will not go to IIS error page, it will go to asp.net web custom error page.
I suggest you could add below web.config setting in system.web tag.
<error statusCode="403" redirect="/default.aspx" />
Besides, if you want to test the IIS custom error page, I suggest you could try to enable the SSL required setting.
If you still use http to access the site, you will receive 403 forbidden error.