SimpleDelegatedModuleProvider.SetChildDelegationState 方法

定义

为指定路径中的所有子配置设置指定的委派状态。

public:
 override void SetChildDelegationState(System::String ^ path, Microsoft::Web::Management::Server::DelegationState ^ state);
public override void SetChildDelegationState (string path, Microsoft.Web.Management.Server.DelegationState state);
override this.SetChildDelegationState : string * Microsoft.Web.Management.Server.DelegationState -> unit
Public Overrides Sub SetChildDelegationState (path As String, state As DelegationState)

参数

path
String

调用主机的路径。

state
DelegationState

DelegationState 设置的对象。

例外

pathnull 或空。

path 包含“/”字符。

示例

以下示例重写此方法并复制基类代码。

public override void SetChildDelegationState(string path,
    DelegationState state) {

    if (String.IsNullOrEmpty(path)) {
        throw new ArgumentNullException("path");
    }
    if (path.IndexOf('/') != -1) {
        throw new InvalidOperationException(
            "Cannot retrieve the delegation state " +
             "for paths that contain '/'.");
    }

    AdministrationModule currentModule =
        ManagementUnit.Administration.Modules[Name];

    // Get the management administration configuration 
    // for the delegated path.
    ManagementAdministrationConfiguration
        delegatedAdministration =
        ManagementUnit.Administration.GetDelegatedScope(path);
    AdministrationModuleCollection delegatedModules
        = delegatedAdministration.Modules;

    if ((state == ParentDelgateState) ||
        (state == ReadWriteDelegationState) ||
        (state == ReadOnlyDelegationState)) {

        delegatedModules.Add(currentModule.Name);
    } else if (state == NoneDelegationState) {
        if (currentModule != null) {
            delegatedModules.Remove(currentModule.Name);
        }
    }
} 

适用于