Best way to abort/cancel action and response from ActionFilter

后端 未结 6 1649
清歌不尽
清歌不尽 2020-12-24 13:51

Best way to abort/cancel action from ActionFilter

I\'ve got this ActionFilter, and it\'s suppose to end the connection immediately and return a 401 Unau

6条回答
  •  我在风中等你
    2020-12-24 14:29

    You can set the result of filterContext for the Exception page like this:

    filterContext.Result = new RedirectResult("~/Error/Unauthorized");
    

    See more details here on section Canceling Filter Execution

提交回复
热议问题