WindowsIdentity.WindowsIdentity(IntPtr, String) Constructor
Assembly: mscorlib (in mscorlib.dll)
The following table shows initial property values for an instance of WindowsIdentity.
| Property | Initial Value |
|---|---|
| Normal | |
| false |
Note: |
|---|
| You can retrieve the token represented by userToken by calling unmanaged code such as the Win32 API LogonUser function. Always release userToken by calling the Win32 API Close function. For more information on calling unmanaged code, see Consuming Unmanaged DLL Functions. |
The following code shows the use of the WindowsIdentity constructor to create a new instance of the WindowsIdentity class for the user represented by the specified Windows account token and the specified authentication type. This code example is part of a larger example provided for the WindowsIdentity class.
String^ authenticationType = "WindowsAuthentication"; WindowsIdentity^ windowsIdentity = gcnew WindowsIdentity( logonToken,authenticationType );
String authenticationType = "WindowsAuthentication";
WindowsIdentity windowsIdentity =
new WindowsIdentity(logonToken, authenticationType);
- SecurityPermission for the ability to manipulate the principal object. Associated enumeration: SecurityPermissionFlag.ControlPrincipal.
- SecurityPermission for the ability to access unmanaged code. Associated enumeration: SecurityPermissionFlag.UnmanagedCode.
Windows Server 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.
Note: