si, intendevo questo, anche se il global.asax ha un aspetto diverso ora, mi pare.
Come dicevo, la cosa che chiedevi è dovuta al fatto che alcuni codici di errore sono gestiti dal web.config/framework, altri (non nativi di ASP.Net), dall'application server, IIS.
Come spiega appunto un articolo sulla configurazione per il redirect alle pagine di errore (https://docs.microsoft.com/en-us/asp...-error-page-cs)
<customErrors mode="RemoteOnly" defaultRedirect="~/ErrorPages/Oops.aspx"><error statusCode="404" redirect="~/ErrorPages/404.aspx" /></customErrors>
The custom error page is only displayed when a request is made to a resource handled by the ASP.NET engine. As we discussed in the Core Differences Between IIS and the ASP.NET Development Server tutorial, the web server may handle certain requests itself. By default, the IIS web server processes requests for static content like images and HTML files without invoking the ASP.NET engine. Consequently, if the user requests a non-existent image file they will get back IIS's default 404 error message rather than ASP.NET's configured error page.