Last post Aug 21, 2017 09:17 PM by PatriceSc
Aug 21, 2017 04:12 PM|jc_santos|LINK
I was implementing a custom Role Provider
public class CustomRoleProvider : RoleProvider
in a .net MVC application with Windows Authentication.
I lost more than two hours trying to figure out why the method
public override string GetRolesForUser(string username)
in the Custom class was working flawlessly and the
public override bool IsUserInRole(string username, string roleName)
This was a really strange adventure, invested lots of time to figure out why the method did not work, was the class , the implementation, the way I was calling the method, was I thinking right?
Turns out it was the "\" ...
Can some one explain me why a method with a signature like method(string a, string b) , can't be called when a string contains a "\" ?
Aug 21, 2017 09:17 PM|PatriceSc|LINK
You would need to look at the method implementation. This is a CustomRoleProvider but this is not your own IsUserInRole implementation ?
Having domaintest rather than domain\test looks weird. What do you see when showing User.Identity.Name and Windows authentication? I believe you should see domain\user, you might see user but I would be really very surprised if you see domainuser without
a domain/user separator !?