ASP.NET User Roles - Create and Assign Roles for AUTHORIZATION!
Вставка
- Опубліковано 8 лип 2024
- 🔥 Want to know how to give your ASP.NET App Users Roles? This is the video!
🚀 C# Progress Academy - Become a senior C# developer: academy.tutorials.eu/p/csharp...
We'll make sure to turn you into a true developer in no time!
Timestamps:
00:00 Introduction
00:25 What are we going to make?
01:44 Add the roles
03:04 This one is for you!
03:30 preparing our application to handle user roles
18:50 Testing the final app
19:00 Thanks for watching!
ASP.NET User Roles - Create and Assign Roles for AUTHORIZATION!
So, what is C#?
C# (pronounced "See Sharp") is a modern, object-oriented, and type-safe programming language. C# enables developers to build many types of secure and robust applications that run in .NET. C# has its roots in the C family of languages and will be immediately familiar to C, C++, Java, and JavaScript programmers. This tour provides an overview of the major components of the language in C# 8 and earlier. If you want to explore the language through interactive examples, try the introduction to C# tutorials.
C# is an object-oriented, component-oriented programming language. C# provides language constructs to directly support these concepts, making C# a natural language in which to create and use software components. Since its origin, C# has added features to support new workloads and emerging software design practices. At its core, C# is an object-oriented language. You define types and their behavior.
And what is ASP.NET?
ASP.NET is an open-source, server-side web-application framework designed for web development to produce dynamic web pages. It was developed by Microsoft to allow programmers to build dynamic web sites, applications and services. The name stands for Active Server Pages Network Enabled Technologies.
And what is Identity?
Is an API that supports user interface (UI) login functionality.
Manages users, passwords, profile data, roles, claims, tokens, email confirmation, and more.
Users can create an account with the login information stored in Identity or they can use an external login provider. Supported external login providers include Facebook, Google, Microsoft Account, and Twitter.
The Identity source code is available on GitHub. Scaffold Identity and view the generated files to review the template interaction with Identity.
Identity is typically configured using a SQL Server database to store user names, passwords, and profile data. Alternatively, another persistent store can be used, for example, Azure Table Storage.
To learn more, make sure to watch the video, and we promise you that you'll become a better developer by the end of the video! Have fun!
And thank you LAKEY INSPIRED for these amazing songs that we use in all our videos! @LAKEYINSPIRED
#csharp #coding #tutorial #learn #microsoft #net #register #roles #authentication
TAGS
c#,.net,c-sharp,csharp,programming,visual studio,c sharp,learn c#,c# programming,c# tutorial,c# for beginners,learn c# programming,c# course,tutorial,coding,registration,authentication,authorization,.net core,asp.net core,asp.net mvc framework,asp.net mvc,asp.net,core,mvc,entity framework,dotnet,roles,asp.net core tutorial,asp.net core mvc,asp.net core identity,role based authorization in asp.net core,asp.net identity,razor pages,users,asp user roles
TutorialsEU offers you free video tutorials about programming and development for complete beginners up to experienced programmers.
This includes C#, Unity, Python, Android, Kotlin, Machine Learning, etc.
Stay tuned and subscribe to tutorialsEU: goo.gl/rBFh3x
C#: / @tutorialseuc
Facebook: / tutorialseu-1093802040...
LinkedIn: / tutorialseu
Discord: / discord
🚀C# Progress Academy - Become a senior C# developer: academy.tutorials.eu/p/csharp-progress-academy
Short, compehensive and straight to the points i was looking for. Thank you!
You saved my day, thank you a lot! I was reading a lot of documentation and no one was so clear and hands on like your video. Now it's working perfect. If you can, please create a video teaching how to create a page to manage roles, manage user roles, manage users. If you want, I'm planning to create this in the next days, so we can talk about this together. THX for all !!!
Awesome man, I spent hours with the Microsoft tutorial and other videos. In 19 minutes you have me up and running. Thank you!
Been searching a few days for exactly this, thank you so much for posting this video!
This is one of the best tuts for ASP Core I found , thank you!
Thank you so much, it worked after I attempted so many videos here on UA-cam.
Loved it! Exactly what I was looking for. Thank you for the great content.
I congratulate you for helping a young developer who has been struggling with this for weeks! I implemented your method in my solution and it works like a charm!!!
Thanks a lot for your comment!
Thank you for this turtorial. Saved me a lot of time!
Hi! My code worked! You got me to subscribe as well! I usually struggle to find videos that help and your video really helped me out! I love the way you explain your code as well. Not information overload but straight to the point. Thank you!!
Thank you very much! Great tutorial :D
I highly recommend this tutorial
I wouldn't believe that was that easy! Thanks!!!
Thanks for making this tutorial, great explanation. I was reading the documentation and this gives me better understanding of the implementation
Thank you soooooooo much, You saved me hours of worries.
Thank you for this clean expression, saved my hours
Thank you very much! Very good explanation. Everything works. Cool!
Very very thank youuu
wish every tutorial was like this
thank you very much!
This is Gold 👌
Perfect!
thank you man
thank you bro
thank you this was great
Great job
What do you think of seeding the password in clear text is that a problem? Can it get exposed e.g. in version control? How to inject the password on compilation for instance?
It was amazing
Wouldn't it be fine using inly one scope instead of two?
man, i love it
usefull 🤩
Thank you for this, great information. Could this similarly be accomplished by adding a row to the existing aspnetusers tabled called "roles"?
can you kindly tell me how to prevent 2 registered user with same role to not access each other data in Asp ,net core??
Hi.Thank you for the tutorial.Can you do part 2 where we put this into a view ?Means a page where we can see all the users and give them roles from the website. That we do not need to give the roles from the database? THANK YOU
yes this! When they create an account how do we add it so they can pick!
Good, informative way. One of tasks for hire is to create CRUD API with User Role authorization. Does Identity work with multiple roles for one user?
Great Video, do you have video on how to create a multi-step form that creates new user and add their role to the database?
My Program.cs looks different and i also have a Startup.cs, everything from this video needed to be added in the Startup.cs file and now my program shows an error screen saying something about a public method named "ConfigureDevelopment" or "Configure" missing from the Startup file. Can someone help me with this?
I am facing an error because my login functionality does not working. Any suggestions ?
How can i customize the "Acces Denied" Page?
Make a small project tutorial like Doctor appointment with CRUD operations or any other small project
As Web API or using the standard MVC template?
@@tutorialsEUC probably mvc!
@@krxthx 100% need it for mvc
I am having trouble adding the assigning the user to Admin the line
await userManager.AddToRoleAsync(user, "Admin");
comes back with foreign key error any suggestions?
did you find the solution yet?
For everyone else, the reason is incredibly stupid. At the stage of creating an instance of your user's class, an error occurs, most often due to the fact that you violated the password or email rules. Didn't add @, didn't add special characters, didn't add capital letters and numbers, and so on... Spend an hour on it 🤦♂@@mo3tsememam82
I get the same error, just now that I thought got close to solve it.
I'm getting an error like this, is yours the same? ` System.InvalidOperationException: The value of 'IdentityUserRole.UserId' is unknown when attempting to save changes. This is because the property is also part of a foreign key for which the principal entity in the relationship is not known.` I can't fix it, I've tried everything and I'm getting ridiculous errors
Great tutorial! However I'm having a blocker when I'm assigning multiple roles to a single user, for example a user is a Company admin and at the same time an Employee and the result was the user can't access the pages with authorization at all. How can I solve this one?
No need to assign the role 'employee' to an admin. Inherently everyone in the company is an employee.
when i am trying to log in with the hard coded data , its not allowing me to log in
Good tutorial, only do this once in a blue moon and forget how to do it everytime!
can i have source code please i cannot see the full code in video that's why source code needed
This seems verbose, wouldn't it be easier to add the roles from your application DB context?
I was thinking the exact same.
Please do a video
AddDefaultIdentity methods doesn't exist