Reputation: 44095
I have a global exception handler in global.asax.cs file in the Application_Error handler which redirects to the error.aspx page. I also have the customError section in my web.config file. When I request a non existing aspx page, the 404.aspx file is NOT shown and the Application_Error handler is fired.
I was expecting 404.aspx to be shown.
<customErrors mode="RemoteOnly" defaultRedirect="error.aspx">
<error statusCode="404" redirect="404.aspx"/>
</customErrors>
Upvotes: 0
Views: 152
Reputation: 15754
Are you viewing the website locally? Because if locally then you'll see an error page since you have the mode set to RemoteOnly. Set mode="On" and see if you get the 404.aspx page.
Upvotes: 2