Blazor Identy using SignInManager from razor page

마루 라온 21 Reputation points

In blazor server i could add Identity scafold to my project and i used this.
But this is written with cshtml and uses Mvc Logics.

So without knowledge with AspNetCore Mvc i started implementing custom login and out.
The Login page was needed so i used it.
But Logout page is not needed.

So i added a click event and Injected SignInManager
@inject SignInManager<IdentityUser> SignInManager

and called

And... it didn't worked well.
I couldn't use debugger because the error was hidden behind code so i couldn't see.

So. here's a Question.
How can i Use asp net core Functions.
And how can i call them from blazor?

A set of technologies in the .NET Framework for building web applications and XML web services.
4,244 questions
A free and open-source web framework that enables developers to create web apps using C# and HTML being developed by Microsoft.
1,422 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. AgaveJoe 26,166 Reputation points

    The SDK comes with project templates that include authentication and authorization. I recommend creating a new project using one of the templates. Then review the code to understand how to configure authentication/authorization in a Blazor application.

    Blazor WASM
    Blazor Server

    0 comments No comments

  2. Jan Mucha 101 Reputation points

    Hello, SignInManager use Http request resposne communication, but blazor is on web socet communication. For example you cannot use cookies in blazor. SignInManager unfortunatly does not work on blazor.
    Try read this article

    0 comments No comments