Share via


SimpleDelegatedModuleProvider.SetChildDelegationState Method

Definition

Sets the specified delegation state for all child configurations in the specified path.

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)

Parameters

path
String

The path of the calling host.

state
DelegationState

The DelegationState object to set.

Exceptions

path is null or empty.

path contains the "/" character.

Examples

The following example overrides this method and duplicates the base class code.

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

Applies to