How to handle custom 404 pages programmatically
Kentico provides the possibility to configure the system to display custom pages instead of standard error messages. Custom pages are convenient for site visitors because they can improve the security of the site by hiding potentially sensitive internal data (such as code in stack traces).
The <customErrors> element under the <system.web> section of the web.config file handles this functionality. However, what if you need to handle custom 404 pages within the code?