AppDomain.SetThreadPrincipal Method (IPrincipal)

 
System_CAPS_noteNote

The .NET API Reference documentation has a new home. Visit the .NET API Browser on docs.microsoft.com to see the new experience.

Sets the default principal object to be attached to threads if they attempt to bind to a principal while executing in this application domain.

Namespace:   System
Assembly:  mscorlib (in mscorlib.dll)

[<SecurityPermissionAttribute(SecurityAction.Demand, Flags = SecurityPermissionFlag.ControlPrincipal)>]
abstract SetThreadPrincipal : 
        principal:IPrincipal -> unit
[<SecurityPermissionAttribute(SecurityAction.Demand, Flags = SecurityPermissionFlag.ControlPrincipal)>]
override SetThreadPrincipal : 
        principal:IPrincipal -> unit

Parameters

principal
Type: System.Security.Principal.IPrincipal

The principal object to attach to threads.

Exception Condition
ArgumentNullException

principal is null.

PolicyException

The thread principal has already been set.

AppDomainUnloadedException

The operation is attempted on an unloaded application domain.

The following example shows the effect of using the SetThreadPrincipal method to change the principal that is available for attaching to threads that are executing in the application domain. It also shows the effect on threads of using the SetPrincipalPolicy method to change the principal policy of the application domain.

No code example is currently available or this language may not be supported.

SecurityPermission

for ability to manipulate the principal object. Associated enumeration: SecurityPermissionFlag.ControlPrincipal. Security action: Demand.

.NET Framework
Available since 1.1
Return to top
Show: