Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All

GenericIdentity.GenericIdentity(String, String) Constructor

Initializes a new instance of the GenericIdentity class representing the user with the specified name and authentication type.

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

'Declaration
Public Sub New ( _
	name As String, _
	type As String _
)
'Usage
Dim name As String
Dim type As String

Dim instance As New GenericIdentity(name, type)
public GenericIdentity (
	String name, 
	String type
)
public function GenericIdentity (
	name : String, 
	type : String
)
Not applicable.

Parameters

name

The name of the user on whose behalf the code is running.

type

The type of authentication used to identify the user.

Exception typeCondition

ArgumentNullException

The name parameter is a null reference (Nothing in Visual Basic).

-or-

The type parameter is a null reference (Nothing in Visual Basic).

The following code shows the use of the GenericIdentity constructor. This code example is part of a larger example provided for the GenericIdentity class.

Dim windowsIdentity As WindowsIdentity = windowsIdentity.GetCurrent()

' Construct a GenericIdentity object based on the current Windows
' identity name and authentication type.
Dim authenticationType As String = windowsIdentity.AuthenticationType
Dim userName As String = windowsIdentity.Name
Dim authenticatedGenericIdentity As _
    New GenericIdentity(userName, authenticationType)

WindowsIdentity windowsIdentity = WindowsIdentity.GetCurrent();
// Construct a GenericIdentity object based on the current Windows
// identity name and authentication type.
String authenticationType = windowsIdentity.get_AuthenticationType();
String userName = windowsIdentity.get_Name();
GenericIdentity authenticatedGenericIdentity 
    = new GenericIdentity(userName, authenticationType);

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.

.NET Framework

Supported in: 3.0, 2.0, 1.1, 1.0

Community Additions

ADD
Show:
© 2015 Microsoft