attribute does not seem to act at all

前端 未结 6 908
佛祖请我去吃肉
佛祖请我去吃肉 2020-12-16 17:58

I am having problems using the [HandleError] attribute on my Controller Actions - it doesn\'t seem to work at all (i.e. it doesn\'t matter if the filter is there or not - I

6条回答
  •  臣服心动
    2020-12-16 18:18

    I tried the above suggestions but nothing worked for me. What did the trick was removing this line from my actions within my error controller.

    Response.StatusCode = (int)HttpStatusCode.NotFound;
    

    I was pulling my hair out since IIS error messages kept intercepting my error handling. And while its not ideal since I want to provide that status code in my response, I found that removing it prevented IIS 7+ from interfering with my error handling.

    DaTribe

提交回复
热议问题