Remember to close this if it is a duplicate. I could not find the answer.
I want to place System.Web.ActionFilterAttribute in an action method and override the OnActionExecuting method to insert business logic that determines whether the action should be performed.
Can I use an ActionExecutingContext to cancel an executable action method and do one of the following:
- Send the HTTP status code (and the corresponding
<customError> page). - Perform a different action method within the same controller.
Kivin source share