Answer the question
In order to leave comments, you need to log in
How to disable redirect to Identity/Account/Login from CustomAuthorizationAttribute?
Tell me, I
use asp.net core with a self-written authorization system (not identity)
, I implemented CustomAuthorizationAttribute,
if successful, a redirect to Identity/Account/Login
Identity occurs
.
Answer the question
In order to leave comments, you need to log in
services.ConfigureApplicationCookie(options =>
{
options.Events.OnRedirectToLogin = context =>
{
context.Response.StatusCode = 401;
return Task.CompletedTask;
};
});
services.AddAuthentication(options => options.DefaultScheme = "Cookies").AddCookie("Cookies", "Cookies", options => {
options.Events.OnRedirectToAccessDenied = context =>
{
context.Response.StatusCode = 403;
return Task.CompletedTask;
}
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question