ManagementUserInfo Class

Definition

Encapsulates information about an IIS Manager user.

public ref class ManagementUserInfo
public class ManagementUserInfo
type ManagementUserInfo = class
Public Class ManagementUserInfo
Inheritance
ManagementUserInfo

Examples

The following example obtains a collection of ManagementUserInfo objects and displays the property values for each element of the collection. The example adds a user to the list of IIS Manager users if the user is not already a member.

// Returns a Property bag that contains the Site Owner Details.
public PropertyBag GetSiteOwnerDetails(string siteName)
{
    PropertyBag SiteOwnerDetailsBag = new PropertyBag();

    AppDomain domain = Thread.GetDomain();
    domain.SetPrincipalPolicy(PrincipalPolicy.WindowsPrincipal);
    WindowsPrincipal principal = (WindowsPrincipal)Thread.CurrentPrincipal;

    // Gets the site from the siteName.
    Site site = base.ManagementUnit.ServerManager.Sites[siteName];
    // Set the path.
    string path = site.Name;
    SiteOwnerDetailsBag.Add(0, principal.Identity.Name);
    SiteOwnerDetailsBag.Add(1, 
        principal.IsInRole(WindowsBuiltInRole.Administrator).ToString());
    SiteOwnerDetailsBag.Add(2, siteName as string);
    // Create a new ManagementUser.
    string managementusername = "SuperManager";
    string managementuserpassword = "password";
    string message = null;
    string display = null;
    ManagementUserInfoCollection managementUserInfoCollection = 
        ManagementAuthentication.GetUsers(0, -1);
    message = "\nUsers count: " + managementUserInfoCollection.Count.ToString();
    display = display + message;
    bool isInCollection = false;
    message = null;
    foreach (ManagementUserInfo userInfo in managementUserInfoCollection)
    {
        message = message + "\nName: " + userInfo.Name;
        message = message + "     Enabled: " + userInfo.Enabled;
        message = message + "     ToString: " + userInfo.ToString();
        // Check to see if the management user is already in the collection.
        if (managementusername.Equals(userInfo.Name))
        {
            isInCollection = true;
        }
    }
    // Add the manager user if not already in the collection.
    if (!isInCollection)
    {
        ManagementUserInfo newManagementUser = 
            ManagementAuthentication.CreateUser(
            managementusername, managementuserpassword);
        message = message + "\nadded: " + managementusername;
    }
    display = display + message;
    SiteOwnerDetailsBag.Add(3, display as string);
    return SiteOwnerDetailsBag;
}

Remarks

This class provides functionality for managing IIS Manager users on the server.

You can configure the server to allow IIS Manager users, from accounts with Windows credentials, to perform management services. A list of authorized users is available on the IIS Manager Users page of IIS Manager. The list is also available in the Administration.config file. IIS Manager users are granted permissions at the server level and are not limited to a specific site or application.

Constructors

ManagementUserInfo(String, Boolean)

Initializes a new instance of the ManagementUserInfo class.

Properties

Enabled

Gets a value indicating whether the IIS Manager user can perform management services in IIS Manager.

Name

Gets the name of the IIS Manager user.

Methods

ToString()

Returns the name of the IIS Manager user.

Applies to