I have an existing ASP.Net application (not Core) with DotVVM being added to it. I have not been able to get the 404 error handling to work correctly.
I need to handle invalid page requests whether the request is for a DotVVM page (no extension) or an ASPX page or other extension.
Previous to adding DotVVM to the application, the following in the web.config worked.
<customErrors defaultRedirect="/Content/Errors/ErrorPage.aspx" mode="RemoteOnly" redirectMode="ResponseRewrite">
<error statusCode="403" redirect="~/Content/Errors/UnauthorizedAccess.aspx" />
<error statusCode="404" redirect="~/Content/Errors/PageNotFound.aspx" />
</customErrors>
After adding DotVVM to the application, the above no longer works, nor do any of the following.
<customErrors defaultRedirect="/Content/Errors/ErrorPage.aspx" mode="On" redirectMode="ResponseRewrite">
<error statusCode="403" redirect="~/Content/Errors/UnauthorizedAccess.aspx" />
<error statusCode="404" redirect="~/Errors/PageNotFound" />
</customErrors>
<customErrors mode="On" redirectMode="ResponseRewrite" >
<error statusCode="404" redirect="/Errors/PageNotFound"/>
</customErrors>
What is the proper way to handle a 404 Page Not Found error in an existing ASP.Net (not Core) application?