Hi,
I am trying to show a modal popup to inform the user that the link/action/resource he selected is no authorized for his role. I have decorated the function with a custom annotation
[AutorizacionUsuarios (Roles = "Informatico") ]
And Override the HandleUnauthorizedRequest
protected override void HandleUnauthorizedRequest(System.Web.Mvc.AuthorizationContext filterContext)
{
if (filterContext.HttpContext.Request.IsAuthenticated)
{
filterContext.Result = new System.Web.Mvc.HttpStatusCodeResult((int)System.Net.HttpStatusCode.Forbidden);
}
else
{
base.HandleUnauthorizedRequest(filterContext);
}But it generates a new page/view with the error info, I would need to show a modal popup dialog on the view/controller that generate the call to the unauthorized functions.
As an example:
If call the funtion Home/GoToClientsList from a button on Home/Index that redirecto to Clients/Index and this function is not authorized for the usere's roles then I would like to show a modal popup on Home/Index informing the user about.