404.aspx


https://forum.kartris.com/Topic6738.aspx
Print Topic | Close Window

By Supermac - Tue 6 Sep 2016
I'd like to know how it works 404 error managing.
I see that page 404.aspx is showed only in certain cases, not for every error server encounters... i.e. it's not showed if I digit an incorrect url with a page that doesn't exist with an extension other than aspx (i.e. pippo.asp prompt to a server error page, pippo.aspx prompt to 404.aspx).
Why?
By Tiggywiggler - Tue 6 Sep 2016
Does your web.config page contain this part:

<customErrors mode="On" defaultRedirect="~/Error.aspx" redirectMode="ResponseRewrite">
<error statusCode="404" redirect="~/404.aspx"/>
</customErrors>

When you say you have a 'server error', what exactly is the error that you get?
By Tiggywiggler - Wed 7 Sep 2016
The other thing to check is the mappings that are set in IIS. If IIS is set to route .asp requests to your site then you should get the 404.aspx page displayed, if you do not have this routing set then the application (Kartris) will not be given an opportunity to respond and IIS will raise the error first.
By Paul - Wed 7 Sep 2016
Check that you are running in an integrated app pool rather than a classic one.

On older versions of IIS, .aspx files would be handled by the asp.net DLL while .asp and other requests were handled by IIS directly. This meant that the settings for error messages in the web.config only really applied to .NET requests (i.e. .aspx) - any requests to classic ASP pages (.asp) would not trigger web.config rules, instead you'd have to set the handling of that up in IIS.

In latter versions of IIS, asp.net is built in, so the web.config applies to everything. Even requests to image files and .asp can trigger rules and code in your asp.net application.

However, you can switch IIS app pools to 'classic' mode, in which case the .asp files would be handled differently again to .aspx ones.