Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
[ASP.NET Core] Deactivate default authentication challenge (Account/Login)
...
namespace BrunoMartinsPro.Startup
{
public class Startup
{
...
public Startup(IHostingEnvironment env)
{
...
}
public void ConfigureServices(IServiceCollection services)
{
...
//when adding an identity if AutomaticChallenge is not specified,
//the middleware will redirect requests to "Account/Login" when authentication is required
services.AddIdentity<ApplicationUser, IdentityRole>(config => {
config.Cookies.ApplicationCookie.AutomaticChallenge = false;
});
...
}
public void Configure(IApplicationBuilder app, IHostingEnvironment env)
{
...
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment