I have an IActionFilter
that does something in OnActionExecuted
, however I don't want to perform this action when the controller result performs a redirect.
My initial thought was to check the type of the ActionResult
as either RedirectResult
or RedirectToRouteResult
, but this isn't reliable as any type of result can perform a redirect (indeed I have two custom ones that do).
Is there another way I can detect when this happens or is it impossible since you won't know about the redirect until the action executes (which is too late to do what I want)?
Perhaps just checking for ViewResult
and PartialViewResult
would be more reliable.