ASP.NET MVC - Catch All Route And Default Route

后端 未结 8 1974
伪装坚强ぢ
伪装坚强ぢ 2020-11-28 04:15

In trying to get my application to produce 404 errors correctly, I have implemented a catch all route at the end of my route table, as shown below:

 routes.M         


        
8条回答
  •  猫巷女王i
    2020-11-28 04:52

    Well, what I have found is that there is no good way to do this. I have set the redirectMode property of the customErrors to ResponseRewrite.

    
        
    
    

    This gives me the sought after behavior, but does not display the formatted page.

    To me this is poorly done, as far as SEO goes. However, I feel there is a solution that I am missing as SO does exactly what I want to happen. The URL remains on the failed page and throws a 404. Inspect stackoverflow.com/fail in Firebug.

提交回复
热议问题