public void OnAuthorization(AuthorizationFilterContext context) { var user = context.HttpContext.User; if (user.Identity.IsAuthenticated == false) { //REDIRECCION DINAMICA ToolkitService.GuardarAcctionController(context); //LOGIN context.Result = ToolkitService.GetRedirectToRoute("Identity", "Login"); } }
public void OnAuthorization(AuthorizationFilterContext context) { var user = context.HttpContext.User; if (user.Identity.IsAuthenticated == false) { //REDIRECCION DINAMICA ToolkitService.GuardarAcctionController(context); //LOGIN //Redirigo al Login context.Result = ToolkitService.GetRedirectToRoute("Identity", "Login"); } else { //SOLO LOS ADMINISTRADORES PUEDEN ENTRAR if (user.IsInRole("ADMIN") == false) { //context.Result = this.GetRedirectToRoute("Identity", "AccesoDenegado"); context.Result = ToolkitService.GetRedirectToRoute("Identity", "AccesoDenegado"); } } }