ServiceAuthorizationBehavior.PrincipalPermissionMode Property

Gets or sets the principal permission mode.

Namespace:  System.ServiceModel.Description
Assembly:  System.ServiceModel (in System.ServiceModel.dll)

public PrincipalPermissionMode PrincipalPermissionMode { get; set; }

This property contains one of the members of the PrincipalPermissionMode enumeration. Valid values are:

  • Custom. A custom IAuthorizationPolicy implementation is used to populate Thread.CurrentPrincipal.

  • None. The Thread.CurrentPrincipal property is not set.

  • UseAspNetRoles. The Thread.CurrentPrincipal property is set to an IPrincipal based on ASP.NET role information.

  • UseWindowsGroups. The Thread.CurrentPrincipal property is set to a WindowsPrincipal based on the user credentials of the incoming message.

This code shows how to set this property.

ServiceHost myServiceHost = new ServiceHost(typeof(Calculator), baseUri);
ServiceAuthorizationBehavior myServiceBehavior =
    myServiceHost.Description.Behaviors.Find<ServiceAuthorizationBehavior>();
myServiceBehavior.PrincipalPermissionMode =
    PrincipalPermissionMode.UseAspNetRoles;

Windows 7, Windows Vista, Windows XP SP2, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003

The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

.NET Framework

Supported in: 3.5, 3.0
Was this page helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft