When any URL is 404 on my site, i want to show a custom 404 page that is rendered with ASP.NET-MVC. Hoewever i do not want to use the wildcard route approach because that would disable standard webforms. My code currently looks like this:
if (serverException is HttpException && ((HttpException)serverException).GetHttpCode() == 404)
{
//Server.Transfer("~/Test.aspx"); //1
//Server.Transfer("~/error/gf54tvmdfguj85fghf/404"); //2
}
this code is inside App_Error
//1 does work. Test.aspx is a standard webform
//2 does not work as it is an asp.net-mvc route
How to make the MVC-route work?