ASP.NET User Roles - Create and Assign Roles for AUTHORIZATION!

แชร์
ฝัง
  • เผยแพร่เมื่อ 23 ม.ค. 2025

ความคิดเห็น • 64

  • @tutorialsEUC
    @tutorialsEUC  ปีที่แล้ว +1

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

  • @clems5204
    @clems5204 ปีที่แล้ว +9

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

    • @tutorialsEUC
      @tutorialsEUC  ปีที่แล้ว

      Thanks a lot for your comment!

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

  • @sandrakyoutube
    @sandrakyoutube ปีที่แล้ว +11

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

  • @willdavis2964
    @willdavis2964 ปีที่แล้ว +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 ปีที่แล้ว

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

  • @TheMoviesManX
    @TheMoviesManX ปีที่แล้ว +1

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

  • @courtneycole4993
    @courtneycole4993 2 หลายเดือนก่อน

    Exactly what I needed! Very Nicely Done!

  • @HELLF1RE
    @HELLF1RE 7 หลายเดือนก่อน

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

  • @AndyBochmann-y6c
    @AndyBochmann-y6c 2 หลายเดือนก่อน

    Exactly what I needed, thank you so much for making this video.

  • @ordinaryBrownDad
    @ordinaryBrownDad 11 หลายเดือนก่อน

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

  • @sibabalonjisane8520
    @sibabalonjisane8520 ปีที่แล้ว

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

  • @buwo_
    @buwo_ 10 หลายเดือนก่อน

    Thank you for this clean expression, saved my hours

  • @utens_g
    @utens_g 6 หลายเดือนก่อน

    Thank you so much. This saved my whole day❤

  • @Laffendo
    @Laffendo ปีที่แล้ว

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

  • @HuskyRiderTR
    @HuskyRiderTR ปีที่แล้ว

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

  • @thedanielspindler
    @thedanielspindler ปีที่แล้ว

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

  • @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 ปีที่แล้ว +2

      did you find the solution yet?

    • @scydevcode
      @scydevcode ปีที่แล้ว

      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 10 หลายเดือนก่อน

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

    • @Emre-qp6fk
      @Emre-qp6fk 8 หลายเดือนก่อน

      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

  • @kingsley3194
    @kingsley3194 11 หลายเดือนก่อน

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

  • @KonstantinBykov-o3k
    @KonstantinBykov-o3k 9 หลายเดือนก่อน

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

  • @new_direction_net
    @new_direction_net ปีที่แล้ว

    This is Gold 👌

  • @carnajx6570
    @carnajx6570 ปีที่แล้ว +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 ปีที่แล้ว

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

  • @AdrenalSnakeREX
    @AdrenalSnakeREX ปีที่แล้ว

    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?

  • @feketeadrian9789
    @feketeadrian9789 ปีที่แล้ว

    Thank you very much! Great tutorial :D

  • @dopplermonk
    @dopplermonk ปีที่แล้ว

    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?

  • @johnkrator
    @johnkrator ปีที่แล้ว

    I highly recommend this tutorial

  • @favourolanipekun4297
    @favourolanipekun4297 ปีที่แล้ว

    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?

  • @ryuksae
    @ryuksae 22 วันที่ผ่านมา

    Thanks!

  • @muhammadubaid3800
    @muhammadubaid3800 ปีที่แล้ว +1

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

  • @alisadiyathool
    @alisadiyathool 8 หลายเดือนก่อน

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

  • @sawairasana
    @sawairasana ปีที่แล้ว +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??

    • @BBtechnology
      @BBtechnology 4 หลายเดือนก่อน

      You could map every resource you create by that user mapped to their user ID that way each user will only get access to data They created or are given access to other users in the event it's a process flow application

  • @steenstiller
    @steenstiller ปีที่แล้ว

    How can i customize the "Acces Denied" Page?

  • @honeylemonteayum
    @honeylemonteayum 9 หลายเดือนก่อน

    thank you this was great

  • @paulsotelo4010
    @paulsotelo4010 4 หลายเดือนก่อน

    Great, thank you

  • @ahmedqasem7651
    @ahmedqasem7651 ปีที่แล้ว

    Great job

  • @xeebodog
    @xeebodog ปีที่แล้ว

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

  • @TENBALZ
    @TENBALZ ปีที่แล้ว

    wish every tutorial was like this

  • @Holsp
    @Holsp ปีที่แล้ว

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

  • @ГеоргийСлавин-р8п
    @ГеоргийСлавин-р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?

  • @estebansaavedra3128
    @estebansaavedra3128 ปีที่แล้ว

    thank you very much!

  • @mohammad6924
    @mohammad6924 8 หลายเดือนก่อน

    Very very thank youuu

  • @abdullahalsubei
    @abdullahalsubei ปีที่แล้ว

    man, i love it

  • @devmarwat
    @devmarwat ปีที่แล้ว

    It was amazing

  • @EminHasanov-nj6un
    @EminHasanov-nj6un ปีที่แล้ว +1

    Perfect!

  • @danhedaiat
    @danhedaiat ปีที่แล้ว

    thank you man

  • @cricomedy7896
    @cricomedy7896 ปีที่แล้ว +2

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

    • @tutorialsEUC
      @tutorialsEUC  ปีที่แล้ว +1

      As Web API or using the standard MVC template?

    • @krxthx
      @krxthx ปีที่แล้ว

      ​@@tutorialsEUC probably mvc!

    • @kiolinharisanker8165
      @kiolinharisanker8165 ปีที่แล้ว +2

      @@krxthx 100% need it for mvc

  • @user-oh7to8xw3j
    @user-oh7to8xw3j ปีที่แล้ว

    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 7 หลายเดือนก่อน +1

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

  • @jessor33
    @jessor33 ปีที่แล้ว

    usefull 🤩

  • @mndilove818
    @mndilove818 11 หลายเดือนก่อน

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

  • @oranasoftware
    @oranasoftware ปีที่แล้ว

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

  • @peymannaji
    @peymannaji 9 หลายเดือนก่อน +1

    AddDefaultIdentity methods doesn't exist

  • @BBtechnology
    @BBtechnology 4 หลายเดือนก่อน

    Question is how do you people know all this stuff, wat's the secret?