Код: Выделить всё
public class AuthorizeSessionAttribute : IAsyncActionFilter
{
public async Task OnActionExecutionAsync(ActionExecutingContext context, ActionExecutionDelegate next)
{
if (AuthorizeCore(context))
{
await next();
}
else
{
HandleUnauthorizedRequest(context);
}
}
protected bool AuthorizeCore(ActionExecutingContext context)
{
// Some not interesting code
}
protected void HandleUnauthorizedRequest(ActionExecutingContext context)
{
// Some not interesting code
if (context.HttpContext.Request.IsAjaxRequest()) {
return new StatusCodeResult((int)HttpStatusCode.MethodNotAllowed);
}
return new RedirectToRouteResult(new RouteValueDictionary(new { action = "Index", controller = "Home" }));
}
}
В чем может быть проблема ? Больше у меня нет информации. Если у меня есть разрешение, я получаю в ответ код 200.
Подробнее здесь: https://stackoverflow.com/questions/790 ... ecomes-404
Мобильная версия