C
C#3y ago
Alparslan~

Core Api User Register Help

Hello. I need help. I'm making the user registration adding process with the log, but I get an error when try add.
8 Replies
Angius
Angius3y ago
Your call to .First() cannot find the given element Nothing matches the predicate And thus, it throws an exception That's why it's generally better to use .FirstOrDefault() and handle the case when the return is null
Alparslan~
Alparslan~OP3y ago
Alparslan~
Alparslan~OP3y ago
Alparslan~
Alparslan~OP3y ago
Why null return ?
Angius
Angius3y ago
Because there's no claim of type UserRolId Possibly a typo? UserRoleId is what you meant?
Alparslan~
Alparslan~OP3y ago
I guess.
Unknown User
Unknown User3y ago
Message Not Public
Sign In & Join Server To View
V0FBU1VM
V0FBU1VM3y ago
@Alparslan Just a tips, there is something called Identity that can simplify what you are doing https://learn.microsoft.com/en-us/aspnet/core/security/authentication/identity?view=aspnetcore-6.0&tabs=visual-studio.
Introduction to Identity on ASP.NET Core
Use Identity with an ASP.NET Core app. Learn how to set password requirements (RequireDigit, RequiredLength, RequiredUniqueChars, and more).
Want results from more Discord servers?
Add your server