views:

26

answers:

1

I'm using MVC 2 with futures, and I'm trying to hide/show content based on role. Is there a way with ActionFilterAttribute or AuthorizeAttribute if the authentication fails to not show the controller child action all through attributes? Or is all I can do with those attributes is redirect or throw up an error message? I just need the child action to return nothing basically if it fails the authentication.

A: 

Looks like you can just assign the result to a blank ActionResult.

protected override void HandleUnauthorizedRequest(AuthorizationContext filterContext) { filterContext.Result = new System.Web.Mvc.EmptyResult(); }

jspence