Last post Jul 25, 2020 09:25 PM by nathan724
Jul 25, 2020 05:53 AM|nathan724|LINK
I am working on a small asp.net web app (web form) which will be deployed to Azure. I need to use ASP.Net Identity. When I create the new project in Visual Studio 2019, I selected Authentication is "Individual User Accounts". But I am not sure my next step
regarding asp.net Identity. I used ASP.Net membership years ago. I used to use SQL stored procedures to manage membership. Does "Identity" work the same way? if yes, where can I find the documentation?
I read the MS documentation but it does not help.
Jul 25, 2020 06:28 AM|PatriceSc|LINK
You have also https://docs.microsoft.com/en-us/aspnet/identity/overview/getting-started/adding-aspnet-identity-to-an-empty-or-existing-web-forms-project
To better understand https://docs.microsoft.com/en-us/aspnet/identity/overview/extensibility/overview-of-custom-storage-providers-for-aspnet-identity can
help. In short this is an API that alows to manage and authenticate users regardless of the actual underlying providers.
To get help a major information is wehter you'll store userrs in a db or if you are using an external identity provider such as Azure AD or ADFS.
Jul 25, 2020 04:04 PM|nathan724|LINK
Thanks for the quick reply. I stored users in a sql server database, where I found out that a few tables were created. Because there is no sql stored procedures in the db, I figured that I should avoid updating the table directly, but use APIs instead, as
you recommended. Right now I do not need to customize the storage provider. Is there a default UI/Provider for me to manage user accounts? If not, what options do I have?
Due to the small scale of this project, I do not intend to build a web UI for manage user accounts. So far I see two options.
I am trying to avoid opion #2 due to my project timeline.
Jul 25, 2020 05:04 PM|mgebhard|LINK
ASP.NET Identity is a service and database for managing user accounts. It takes a few minutes to setup or you can create a new project and include the Individual Account option under Authentication. The template contains sample UI for registration, login,
and basic account management.
Most of the time you'll use the UserManager API to interact with user accounts. If all you need are user accounts with roles/claims support then you should be up and running in a few minutes and can focus on the business needs at hand.
Jul 25, 2020 06:58 PM|nathan724|LINK
Thanks. Right now all I need are user accounts with roles.
By "template" you meant those pages inside "Account" folder when I created the project in visual studio, right? I went through those pages and they are all for managing the user that is currently login, such as reset a password. I did not see a page for
setting up a role and assign a user to a role. Am I wrong? If not, then I do need to write codes (page or backend code) for managing roles.
Jul 25, 2020 07:36 PM|mgebhard|LINK
I did not see a page for setting up a role and assign a user to a role. Am I wrong? If not, then I do need to write codes (page or backend code) for managing roles.
You are not wrong. Assigning a role to a user is one line of code. I have no idea how your application works but typically when a use registers they are in a "User" role or least privileged role. Elevated privileges generally require an admin page. That
logic and UI you'll need to create. Seriously creating a few pages to assign users roles should take you maybe 30 minutes to an hour. You can probably scaffold most if it. Create a list page to list all the users and their roles with an edit button. The
edit page allows you to assign the role. Pretty basic stuff.
Jul 25, 2020 09:25 PM|nathan724|LINK
Thanks again. I will try that.