I create a EF code first database identity system with custom roles. When i register a user i put him in a role, and in the database i can see that works on the AspNetUserRoles table.
But when i try to check the user role using User.IsInRole("admin") i.e, it always return false( i tried with low, upper, all the way case). I need to put something in the webconfig? Or what im missing here? Its my first time developing with this new Identity system and i think that is a bit confuse.
In my immediate window:
User.Identity.Name
"teste06"
User.Identity.IsAuthenticated
true
User.IsInRole("admin")
A first chance exception of type 'System.Data.SqlClient.SqlException' occurred in System.Data.dll
Exception:
A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)