开发者

handling exceptions IN Action Filters

开发者 https://www.devze.com 2022-12-11 04:14 出处:网络
Is there a better way to handle exceptions that occur inside an Action Filter itself in ASP .NET MVC?

Is there a better way to handle exceptions that occur inside an Action Filter itself in ASP .NET MVC?

There're 2 ways I can think of at the moment.

  1. Using a try catch and setting the HTTP Status Error code and message directly when an exception occurs
  2. Response.Redirect to the custom error page
  3. 开发者_开发问答


You may implement IExceptionFilter to separate exception handling from the rest of the filter logic.

0

精彩评论

暂无评论...
验证码 换一张
取 消