Using of HandleErrorAttribute in ASP.NET MVC application

前端 未结 2 547
清歌不尽
清歌不尽 2021-02-14 15:14

I have a question about the best way of using HandleErrorAttribute in my MVC 5 application. As we know, we can add this attribute to global filters like that:

 f         


        
2条回答
  •  一向
    一向 (楼主)
    2021-02-14 16:13

    Matt is right about global.asax... this is the example I followed http://www.digitallycreated.net/Blog/57/getting-the-correct-http-status-codes-out-of-asp.net-custom-error-pages

    Then in each view I added: Response.StatusCode = 500; or which ever other code I wanted to show back to the client.

提交回复
热议问题