© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•2y ago
Antlin23

asp.net 7 core mvc Roles not working.

Im adding the roles to the user and the database updates with the correct information (it seems) but [Authorize(Roles = "Admin")] and IsInRole("Admin") doesent work and I found that super wierd. Even with the normal User, even tho they have the role in the database IsInRole always returns false. Does any1 have any tips? In the if statement it show below t aways goes to the last statement even tho they have the role in the database.
Skarmbild_2024-04-14_144011.png
Skarmbild_2024-04-14_143938.png
Skarmbild_2024-04-14_143850.png
Skarmbild_2024-04-14_143835.png
C# banner
C#Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,871Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

ASP.NET Core MVC Structure
C#CC# / help
4w ago
✅ ASP.NET Core MVC error
C#CC# / help
3y ago