System.Net.NetworkCredential Class

public class NetworkCredential : ICredentials

Base Types

Object
  NetworkCredential

This type implements ICredentials.

Assembly

System

Library

Networking

Summary

Provides credentials for password-based authentication.

Description

The NetworkCredential class supplies client credentials used in password-based authentication schemes such as Kerberos.

[Note: Classes that implement the ICredentials interface, such as the CredentialCache class, return NetworkCredential instances.

This class does not support public key-based authentication methods such as SSL client authentication.

]

See Also

System.Net Namespace

Members

NetworkCredential Constructors

NetworkCredential() Constructor
NetworkCredential(System.String, System.String) Constructor
NetworkCredential(System.String, System.String, System.String) Constructor

NetworkCredential Methods

NetworkCredential.GetCredential Method

NetworkCredential Properties

NetworkCredential.Domain Property
NetworkCredential.Password Property
NetworkCredential.UserName Property


NetworkCredential() Constructor

public NetworkCredential();

Summary

Constructs and initializes a new instance of the NetworkCredential class.

Description

The properties of the new NetworkCredential instance are initialized to null .

See Also

System.Net.NetworkCredential Class, System.Net Namespace

NetworkCredential(System.String, System.String) Constructor

public NetworkCredential(string userName, string password);

Summary

Constructs and initializes a new instance of the NetworkCredential class with the specified user name and password.

Parameters

userName
A String containing the user name for the account associated with the credentials.
password
A String containing the password for the account associated with the credentials.

Description

This constructor initializes the System.Net.NetworkCredential.UserName property of the new instance to userName and the System.Net.NetworkCredential.Password property to password. The System.Net.NetworkCredential.Domain property is initialized to System.String.Empty. The values specified for userName and password are passed through to the operating system without modification.

See Also

System.Net.NetworkCredential Class, System.Net Namespace

NetworkCredential(System.String, System.String, System.String) Constructor

public NetworkCredential(string userName, string password, string domain);

Summary

Constructs and initializes a new instance of the NetworkCredential class with the specified user name, password, and domain.

Parameters

userName
A String containing the user name associated with the credentials.
password
A String containing the password for the user name associated with the credentials.
domain
A String containing the domain associated with the credentials.

Description

This constructor initializes the System.Net.NetworkCredential.UserName property of the new instance to userName, the System.Net.NetworkCredential.Password property to password, and the System.Net.NetworkCredential.Domain property to domain. The values specified for userName, password and domain are passed through to the operating system without modification.

See Also

System.Net.NetworkCredential Class, System.Net Namespace

NetworkCredential.GetCredential Method

public NetworkCredential GetCredential(Uri uri, string authType);

Summary

Returns the current instance.

Parameters

uri
A Uri representing the resource for which the client is to be authenticated.
authType
A String containing the System.Net.IAuthenticationModule.AuthenticationType of the IAuthenticationModule that will receive the credentials returned by this method.

Return Value

The current NetworkCredential instance.

See Also

System.Net.NetworkCredential Class, System.Net Namespace

NetworkCredential.Domain Property

public string Domain { get; set; }

Summary

Gets or sets the domain or machine name that verifies the current credentials.

Property Value

A String containing the name of the domain that verifies the current credentials.

Description

The System.Net.NetworkCredential.Domain property indicates the domain or realm to which the account belongs. [Note: Typically, this is the host machine name where the application executes or the user domain for the currently logged in user.]

See Also

System.Net.NetworkCredential Class, System.Net Namespace

NetworkCredential.Password Property

public string Password { get; set; }

Summary

Gets or sets the password of the account associated with the current credentials.

Property Value

A String containing the password of the account associated with the current credentials.

See Also

System.Net.NetworkCredential Class, System.Net Namespace

NetworkCredential.UserName Property

public string UserName { get; set; }

Summary

Gets or sets the user name for the account associated with the current credentials.

Property Value

A String containing the user name for the account associated with the current credentials.

See Also

System.Net.NetworkCredential Class, System.Net Namespace