다음을 통해 공유


ManagementUserInfo 클래스

정의

IIS 관리자 사용자에 대한 정보를 캡슐화합니다.

public ref class ManagementUserInfo
public class ManagementUserInfo
type ManagementUserInfo = class
Public Class ManagementUserInfo
상속
ManagementUserInfo

예제

다음 예제에서는 개체의 컬렉션을 가져오고 컬렉션의 ManagementUserInfo 각 요소에 대 한 속성 값을 표시 합니다. 이 예제에서는 사용자가 아직 멤버가 아닌 경우 IIS Manager 사용자 목록에 사용자를 추가합니다.

// 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;
}

설명

이 클래스는 서버에서 IIS Manager 사용자를 관리하기 위한 기능을 제공합니다.

Windows 자격 증명이 있는 계정에서 IIS 관리자 사용자가 관리 서비스를 수행할 수 있도록 서버를 구성할 수 있습니다. 권한 있는 사용자 목록은 IIS Manager의 IIS 관리자 사용자 페이지에서 사용할 수 있습니다. 목록은 Administration.config 파일에서도 사용할 수 있습니다. IIS 관리자 사용자에게는 서버 수준에서 권한이 부여되며 특정 사이트 또는 애플리케이션으로 제한되지 않습니다.

생성자

ManagementUserInfo(String, Boolean)

ManagementUserInfo 클래스의 새 인스턴스를 초기화합니다.

속성

Enabled

IIS 관리자 사용자가 IIS 관리자에서 관리 서비스를 수행할 수 있는지 여부를 나타내는 값을 가져옵니다.

Name

IIS 관리자 사용자의 이름을 가져옵니다.

메서드

ToString()

IIS 관리자 사용자의 이름을 반환합니다.

적용 대상