I'm trying to use Roles for my forms authentication, I've got the global.asax Application_AuthenticateRequest method getting the roles from the cookie, that works fine. But I don't know what provider to configure in Web.Config. I don't want to use SQL server, just the cookie.
this line creates the IPrincipal: (roles is a string array with the roles)
Context.User = new GenericPrincipal(Context.User.Identity, roles);
The end goal is to get DataAnnotations like [Authorize(Roles = "Admin")] and the IsInRole method working.
Also, the IsInRole method works fine when used in the global.asax but not elsewhere. Why not?
Web.config is configured as such for now:
<roleManager defaultProvider="DefaultRoleProvider" cacheRolesInCookie="true">
and the DefaultProvider is sadly connected to some empty SQL db for no real reason.
Is this even possible?
Thanks.