If you needed to add a user to a specific role immediately after creating them programmatically, which method of the UserManager class would you use?
- AddToRoleAsync
- AddClaimAsync
- AddToRole
- AddPasswordAsync
To add a user to a specific role immediately after creating them programmatically, you would use the AddToRoleAsync method of the UserManager class. This method allows you to assign a user to a role, granting them the associated permissions and access rights.
Loading...
Related Quiz
- You notice that despite having a "Details" action method in your "Products" controller, navigating to "/Products/Details/5" results in a 404 error. What could be a probable cause?
- Which method is commonly used in the Startup.cs file to enable the serving of static files in an ASP.NET Core application?
- In a CI/CD pipeline, what does the acronym CI stand for?
- If you want to code for ASP.NET Core and prefer a lightweight, cross-platform editor, which tool would you likely use?
- You're creating a Razor view and want to use a different layout just for this specific view, overriding the default. How can you specify a different layout within your Razor view?