asp.netsitemapprovideriprincipalisinroleisaccessibletouser

How does IPrincipal gets its roles?


I need to get know how SiteMapProvider.IsAccessibleToUser() works.

Built-in XmlSiteMapProvider calls HttpContext.User.IsInRole() which uses System.Security.Principal.GenericPrincipal in case of forms authentication.

Where does the current user gets its roles? Which provider loads this kind of information? I want to overload it and use custom logic.


Solution

  • You do this by implementing a RoleProvider. Check out these links:

    http://msdn.microsoft.com/en-us/library/8fw7xh74.aspx

    http://www.codeproject.com/KB/aspnet/WSSecurityProvider.aspx