Whatever happens to the Cancel property in an ActionExecutingContext? How can I interrupt RenderAction when using ActionFilterAttribute or is there any other way to trick this cat?
public override void OnActionExecuting(ActionExecutingContext filterContext) { if(!filterContext.HttpContext.User.Identity.IsAuthenticated) { return; } base.OnActionExecuting(filterContext); }
Does the above code continue to perform the action to which it was applied despite exiting the OnActionExecuting operation?
--- In addition to the original post: Thanks for the answers below, however, I don’t think I made the context clear enough, I am trying to invalidate the following call:
<% Html.RenderAction("Menu", "Shared", new { id = Model.OtherUserId }); %>
If the user is not authenticated, this action should not return anything, I could easily place the "if" block in the view, however I would like to save the rule in the controller.
override model-view-controller renderaction actionfilterattribute
rjarmstrong
source share