ManagementAuthorization.IsAuthorized Method (IPrincipal, String)

IIS 7.0
 

Retrieves a value indicating whether the specified principal is authorized for the specified configuration path.

Namespace:   Microsoft.Web.Management.Server
Assembly:  Microsoft.Web.Management (in Microsoft.Web.Management.dll)

public static bool IsAuthorized(
	IPrincipal principal,
	string configurationPath
)

Parameters

principal
Type: System.Security.Principal.IPrincipal

A System.Security.Principal.IPrincipal interface that represents the security context of the user on whose behalf the code is running.

configurationPath
Type: System.String

The configuration path.

Return Value

Type: System.Boolean

true if the principal is authorized for the specified configuration path; otherwise, false.

Exception Condition
System.ArgumentNullException

principal or configurationPath is null.

This method checks the Administration.config file to determine whether the principal is an authorized user for the specified configuration path.

The following example demonstrates the IsAuthorized method. This code example is part of a larger example provided for the ManagementAuthorization class.

The following example sets the principal parameter to an object that enables you to check the Windows group membership of the current user.

Return to top
Show: