I am having an attibute
public class RequiresAdminRights : ActionFilterAttribute
    {
        public override void OnActionExecuting(ActionExecutingContext filterContext)
        {
            User user = User.Load(HttpContext.Current.User.Identity.Name);
            if (user != null)
            {
                if (!(user.IsInRole(Role.Administrator)))
                    throw new Exception("You need admin rights to access this resource.");
            }
        }
    }
In my controller I have
[Attributes.RequiresAdminRights]
public class UserController : Controller
{
    public ActionResult Index()
    {
        return View();
    }
}
The user logged in doesnt have any admin right and the RequiresAdminRights throws an exception. How can I display the exception message?
 
     
    