As of ASP.NET Core 2.x:
services.ConfigureApplicationCookie(options =>
{
options.Events.OnRedirectToLogin = context =>
{
context.Response.StatusCode = 401;
return Task.CompletedTask;
};
});
More Related Contents:
- .NET Core 2.1 Identity get all users with their associated roles
- Asp.net core Identity successful login redirecting back to login page
- Multiple Identities in ASP.NET Core 2.0
- ASP.NET Core Identity 2.0 SignoutAsync is not logging out user if the user signed in with Google
- Identity UI no longer works after switching to .net core 3 endpoint routing
- How to give custom implementation of UpdateAsync method of asp.net identity?
- How to load navigation properties on an IdentityUser with UserManager
- Unable to resolve service for type ‘Microsoft.AspNetCore.Identity.UserManager` while attempting to activate ‘AuthController’
- Can’t use Count() in C#
- How to get current user in asp.net core
- Add client certificate to .NET Core HttpClient
- Change route collection of MVC6 after startup
- @Html.Action in Asp.Net Core
- Transitive references in .Net Core 1.1
- How to turn off or handle camelCasing in JSON response ASP.NET Core?
- Mock HttpContext for unit testing a .NET core MVC controller?
- What are the costs and possible side effects of calling BuildServiceProvider() in ConfigureServices()
- Custom Authentication in ASP.Net-Core
- Manipulating images with .NET Core
- Is there an Entity Framework 7 Database-First POCO Generator?
- ASP.NET Core disable authentication in development environment
- ASP.NET Core API only returning first result of list
- loading a full hierarchy from a self referencing table with EntityFramework.Core
- Generate access token with IdentityServer4 without password
- Simple token based authentication/authorization in asp.net core for Mongodb datastore
- Intercept bad requests before reaching controller in ASP.NET Core
- Customize automatic response on validation error
- Register AspNetCore 2.1 Identity system with DbContext interface
- Customize JSON property name for options in ASP.NET Core
- ASP.NET Core – Authorization Using Windows Authentication