NTAccount Constructor (String, String)


Initializes a new instance of the NTAccount class by using the specified domain name and account name.

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

public NTAccount(
	string domainName,
	string accountName


Type: System.String

The name of the domain. This parameter can be null or an empty string. Domain names that are null values are treated like an empty string.

Type: System.String

The name of the account. This parameter cannot be null or an empty string.

Exception Condition

accountName is null.


accountName is an empty string.


accountName is too long.


domainName is too long.

The specified domain and account names are not required to correspond to an existing account or group, but translation into other IdentityReference-derived types will not be possible unless the account or group does exist.

.NET Framework
Available since 2.0
Return to top