Search code examples
securitysitecoremembership-providersitecore7.5

How can I programmatically get a list of all of the Sitecore domains in a site?


In Sitecore 7.5 I would like to be able to get a list of all of the current Sitecore domains in code. I know that Sitecore security is simply built on top of the ASP.NET Membership Provider, but I can't seem to find any documentation on how to get a list of all of the domains in code.

Thanks, Corey


Solution

  • There is a GetDomains() method in Sitecore.SecurityModel.DomainManager class:

    /// <summary>
    /// Gets all domains handled by the current provider.
    /// </summary>
    public static System.Collections.Generic.IEnumerable<Domain> GetDomains()