Using this code for authentification:
HttpContext.Current.User=new GenericPrincipal
(new GenericIdentity(user.UserName), roles);
FormsAuthentication.SetAuthCookie(user.UserName,false);
Problem is – on next request, HttpContext.Current.User.IsAuthenticated is true, but HttpContext.Current.User.IsInRole("admin") is false.
There are a lot of info on google but somehow nothing helps as usual.
Tried to add this to my web.config:
<system.web>
<roleManager enabled="false" />
</system.web>
I do not want to use membership provider.
Any tips?
I think you might be trying to use the wrong kind of Identity if you’re using forms authentication. You might be better off using FormsIdentity.
Article on Best Practices for Forms Authentication (might be outdated)