GenericIdentity GenericIdentity GenericIdentity GenericIdentity Constructors

Definition

Overloads

GenericIdentity(GenericIdentity) GenericIdentity(GenericIdentity) GenericIdentity(GenericIdentity) GenericIdentity(GenericIdentity)

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

GenericIdentity(String) GenericIdentity(String) GenericIdentity(String) GenericIdentity(String)

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

GenericIdentity(String, String) GenericIdentity(String, String) GenericIdentity(String, String) GenericIdentity(String, String)

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

GenericIdentity(GenericIdentity) GenericIdentity(GenericIdentity) GenericIdentity(GenericIdentity) GenericIdentity(GenericIdentity)

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

protected:
 GenericIdentity(System::Security::Principal::GenericIdentity ^ identity);
protected GenericIdentity (System.Security.Principal.GenericIdentity identity);
new System.Security.Principal.GenericIdentity : System.Security.Principal.GenericIdentity -> System.Security.Principal.GenericIdentity
Protected Sub New (identity As GenericIdentity)
Parameters
identity
GenericIdentity GenericIdentity GenericIdentity GenericIdentity

The object from which to construct the new instance of GenericIdentity.

GenericIdentity(String) GenericIdentity(String) GenericIdentity(String) GenericIdentity(String)

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

public:
 GenericIdentity(System::String ^ name);
public GenericIdentity (string name);
new System.Security.Principal.GenericIdentity : string -> System.Security.Principal.GenericIdentity
Public Sub New (name As String)
Parameters
name
String String String String

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

Exceptions

Examples

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

GenericIdentity^ defaultIdentity = gcnew GenericIdentity( "DefaultUser" );
GenericIdentity defaultIdentity = new GenericIdentity("DefaultUser");
Dim defaultIdentity As New GenericIdentity("DefaultUser")

GenericIdentity(String, String) GenericIdentity(String, String) GenericIdentity(String, String) GenericIdentity(String, String)

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

public:
 GenericIdentity(System::String ^ name, System::String ^ type);
public GenericIdentity (string name, string type);
new System.Security.Principal.GenericIdentity : string * string -> System.Security.Principal.GenericIdentity
Public Sub New (name As String, type As String)
Parameters
name
String String String String

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

type
String String String String

The type of authentication used to identify the user.

Exceptions

The name parameter is null.

-or-

The type parameter is null.

Examples

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

WindowsIdentity^ windowsIdentity = WindowsIdentity::GetCurrent();

// Construct a GenericIdentity object based on the current Windows
// identity name and authentication type.
String^ authenticationType = windowsIdentity->AuthenticationType;
String^ userName = windowsIdentity->Name;
GenericIdentity^ authenticatedGenericIdentity = gcnew GenericIdentity( userName,authenticationType );
WindowsIdentity windowsIdentity = WindowsIdentity.GetCurrent();

// Construct a GenericIdentity object based on the current Windows
// identity name and authentication type.
string authenticationType = windowsIdentity.AuthenticationType;
string userName = windowsIdentity.Name;
GenericIdentity authenticatedGenericIdentity =
    new GenericIdentity(userName, authenticationType);
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)

Applies to