I use ASP.NET Core 3.1 Blazor webassembly application (the default one created by Visual Studio 2019).
I hooked up ASP.NET Identity for user management, added scaffolded Identity item (login, registration etc)
When I click Register , the application correctly redirects to
https://localhost:44349/Identity/Account/Register
but if I click Login , the application redirects to
https://localhost:44349/Account/Login
which is wrong (I expect https://localhost:44349/Identity/Account/Login
)
LoginDisplay.razor:
<AuthorizeView>
<Authorized>
<a href="authentication/profile">Hello, @context.User.Identity.Name!</a>
<button class="nav-link btn btn-link" @onclick="BeginSignOut">Log out</button>
</Authorized>
<NotAuthorized>
<a href="authentication/register">Register</a>
<a href="authentication/login">Log in</a>
</NotAuthorized>
</AuthorizeView>
What did I miss?
by replacing
services.AddIdentity<ApplicationUser, IdentityRole>(options => options.SignIn.RequireConfirmedAccount = true)
.AddEntityFrameworkStores<ApplicationDbContext>()
.AddDefaultTokenProviders();
with
services.AddDefaultIdentity<ApplicationUser>(options => options.SignIn.RequireConfirmedAccount = true)
.AddEntityFrameworkStores<ApplicationDbContext>()
.AddDefaultTokenProviders();
I resolved the issue
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.