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

КОМЕНТАРІ • 61

  • @tutorialsEUC
    @tutorialsEUC  10 місяців тому +1

    🚀C# Progress Academy - Become a senior C# developer: academy.tutorials.eu/p/csharp-progress-academy

  • @sandrakyoutube
    @sandrakyoutube Рік тому +9

    Short, compehensive and straight to the points i was looking for. Thank you!

  • @ViniciusBilieri
    @ViniciusBilieri Рік тому +7

    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 !!!

  • @willdavis2964
    @willdavis2964 10 місяців тому +5

    Awesome man, I spent hours with the Microsoft tutorial and other videos. In 19 minutes you have me up and running. Thank you!

  • @sharonroy9877
    @sharonroy9877 5 місяців тому

    Been searching a few days for exactly this, thank you so much for posting this video!

  • @TheMoviesManX
    @TheMoviesManX 9 місяців тому +1

    This is one of the best tuts for ASP Core I found , thank you!

  • @sibabalonjisane8520
    @sibabalonjisane8520 Рік тому

    Thank you so much, it worked after I attempted so many videos here on UA-cam.

  • @thedanielspindler
    @thedanielspindler Рік тому

    Loved it! Exactly what I was looking for. Thank you for the great content.

  • @clems5204
    @clems5204 Рік тому +7

    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!!!

  • @Laffendo
    @Laffendo Рік тому

    Thank you for this turtorial. Saved me a lot of time!

  • @HELLF1RE
    @HELLF1RE Місяць тому

    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!!

  • @feketeadrian9789
    @feketeadrian9789 Рік тому

    Thank you very much! Great tutorial :D

  • @johnkrator
    @johnkrator 11 місяців тому

    I highly recommend this tutorial

  • @666motovlog
    @666motovlog 9 місяців тому

    I wouldn't believe that was that easy! Thanks!!!

  • @ordinaryBrownDad
    @ordinaryBrownDad 4 місяці тому

    Thanks for making this tutorial, great explanation. I was reading the documentation and this gives me better understanding of the implementation

  • @kingsley3194
    @kingsley3194 5 місяців тому

    Thank you soooooooo much, You saved me hours of worries.

  • @buwo_
    @buwo_ 3 місяці тому

    Thank you for this clean expression, saved my hours

  • @user-cp7cy5uy1b
    @user-cp7cy5uy1b 2 місяці тому

    Thank you very much! Very good explanation. Everything works. Cool!

  • @mohammad6924
    @mohammad6924 Місяць тому

    Very very thank youuu

  • @TENBALZ
    @TENBALZ 6 місяців тому

    wish every tutorial was like this

  • @estebansaavedra3128
    @estebansaavedra3128 8 місяців тому

    thank you very much!

  • @new_direction_net
    @new_direction_net 7 місяців тому

    This is Gold 👌

  • @EminHasanov-nj6un
    @EminHasanov-nj6un Рік тому +1

    Perfect!

  • @danhedaiat
    @danhedaiat 7 місяців тому

    thank you man

  • @tphilearnscode
    @tphilearnscode 3 місяці тому

    thank you bro

  • @honeylemonteayum
    @honeylemonteayum 2 місяці тому

    thank you this was great

  • @ahmedqasem7651
    @ahmedqasem7651 5 місяців тому

    Great job

  • @lassemunktechnerd
    @lassemunktechnerd Рік тому

    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?

  • @devmarwat
    @devmarwat 8 місяців тому

    It was amazing

  • @Holsp
    @Holsp Рік тому

    Wouldn't it be fine using inly one scope instead of two?

  • @abdullahalsubei
    @abdullahalsubei 5 місяців тому

    man, i love it

  • @jessor33
    @jessor33 Рік тому

    usefull 🤩

  • @xeebodog
    @xeebodog 6 місяців тому

    Thank you for this, great information. Could this similarly be accomplished by adding a row to the existing aspnetusers tabled called "roles"?

  • @user-xw5qu2re4g
    @user-xw5qu2re4g Рік тому +3

    can you kindly tell me how to prevent 2 registered user with same role to not access each other data in Asp ,net core??

  • @carnajx6570
    @carnajx6570 11 місяців тому +2

    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

    • @emilyalbert3366
      @emilyalbert3366 5 місяців тому

      yes this! When they create an account how do we add it so they can pick!

  • @user-ec3nv8rh9l
    @user-ec3nv8rh9l 8 місяців тому

    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?

  • @favourolanipekun4297
    @favourolanipekun4297 5 місяців тому

    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?

  • @AdrenalSnakeREX
    @AdrenalSnakeREX 8 місяців тому

    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?

  • @muhammadubaid3800
    @muhammadubaid3800 Рік тому +1

    I am facing an error because my login functionality does not working. Any suggestions ?

  • @steenstiller
    @steenstiller 5 місяців тому

    How can i customize the "Acces Denied" Page?

  • @cricomedy7896
    @cricomedy7896 Рік тому +2

    Make a small project tutorial like Doctor appointment with CRUD operations or any other small project

  • @Josiahtkd
    @Josiahtkd Рік тому +4

    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?

    • @mo3tsememam82
      @mo3tsememam82 10 місяців тому +2

      did you find the solution yet?

    • @scydevcode
      @scydevcode 7 місяців тому

      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

    • @lukask028
      @lukask028 3 місяці тому

      I get the same error, just now that I thought got close to solve it.

    • @Emre-qp6fk
      @Emre-qp6fk 2 місяці тому

      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

  • @user-oh7to8xw3j
    @user-oh7to8xw3j 9 місяців тому

    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?

    • @davidkuseh1097
      @davidkuseh1097 13 днів тому +1

      No need to assign the role 'employee' to an admin. Inherently everyone in the company is an employee.

  • @alisadiyathool
    @alisadiyathool Місяць тому

    when i am trying to log in with the hard coded data , its not allowing me to log in

  • @oranasoftware
    @oranasoftware 10 місяців тому

    Good tutorial, only do this once in a blue moon and forget how to do it everytime!

  • @mndilove818
    @mndilove818 5 місяців тому

    can i have source code please i cannot see the full code in video that's why source code needed

  • @jbob34345
    @jbob34345 11 місяців тому +2

    This seems verbose, wouldn't it be easier to add the roles from your application DB context?

  • @peymannaji
    @peymannaji 2 місяці тому

    AddDefaultIdentity methods doesn't exist