How to use mssql server database table to authenticate a user in a blazor server authentication?

mwy 20 Reputation points
2024-07-30T03:02:21.8466667+00:00

How to use mssql server database table to authenticate a user in a blazor server authentication?

Blazor
Blazor
A free and open-source web framework that enables developers to create web apps using C# and HTML being developed by Microsoft.
1,578 questions
{count} votes

Accepted answer
  1. Tiny Wang-MSFT 2,646 Reputation points Microsoft Vendor
    2024-07-30T05:45:21.1833333+00:00

    Hi @mwy, do you mean you want to add sign-in module into your blazor server application and allow users to sign in with accounts which are stored in the sql server database? If so, asp.net core default identity might be helpful to you. You can use VS 2022 and create a blazor server application(blazor server doesn't exist in .Net8, we have blazor web app in .Net 8, you can try to choose .Net6 or .Net7 for blazor server test), and please choose Individual Account as the Authentication Type.

    User's image

    Then you will get a project which already have all the required codes for sign-in module. Please check the appsettings.json file and you will see a connection string to the local test database(View -> Sql Server Object Explorer).

    User's image


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    Best regards,
    Tiny


0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.