.NET Framework Class Library
WindowsPrincipal Constructor

Initializes a new instance of the WindowsPrincipal class by using the specified WindowsIdentity object.

Namespace:  System.Security.Principal
Assembly:  mscorlib (in mscorlib.dll)
Syntax

Visual Basic (Declaration)
Public Sub New ( _
    ntIdentity As WindowsIdentity _
)
Visual Basic (Usage)
Dim ntIdentity As WindowsIdentity

Dim instance As New WindowsPrincipal(ntIdentity)
C#
public WindowsPrincipal(
    WindowsIdentity ntIdentity
)
Visual C++
public:
WindowsPrincipal(
    WindowsIdentity^ ntIdentity
)
JScript
public function WindowsPrincipal(
    ntIdentity : WindowsIdentity
)

Parameters

ntIdentity
Type: System.Security.Principal..::.WindowsIdentity
The WindowsIdentity object from which to construct the new instance of WindowsPrincipal.
Exceptions

ExceptionCondition
ArgumentNullException

ntIdentity is nullNothingnullptra null reference (Nothing in Visual Basic).

Examples

The following example creates a new WindowsPrincipal object from the current WindowsIdentity object.

Visual Basic
Dim wi As WindowsIdentity = WindowsIdentity.GetCurrent()
Dim wp As New WindowsPrincipal(wi)        

C#
WindowsIdentity wi = WindowsIdentity.GetCurrent();
WindowsPrincipal wp = new WindowsPrincipal(wi);

Visual C++
WindowsIdentity^ wi = WindowsIdentity::GetCurrent();
WindowsPrincipal^ wp = gcnew WindowsPrincipal( wi );
Platforms

Windows 7, Windows Vista, Windows XP SP2, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP Starter Edition, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003, Windows Server 2000 SP4, Windows Millennium Edition, Windows 98

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.
Version Information

.NET Framework

Supported in: 3.5, 3.0, 2.0, 1.1, 1.0
See Also

Reference

Tags :


Page view tracker