Export (0) Print
Expand All

GenericIdentity Constructor (String, String)

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)

public GenericIdentity (
	string name,
	string type
)
public GenericIdentity (
	String name, 
	String type
)
public function GenericIdentity (
	name : String, 
	type : String
)

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.

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);

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 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 .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.

.NET Framework

Supported in: 2.0, 1.1, 1.0

Community Additions

ADD
Show:
© 2014 Microsoft