System.Net.CredentialCache.GetCredential Method

Returns the System.Net.NetworkCredential instance associated with the specified host, port, and authentication protocol.

Syntax

public NetworkCredential GetCredential (string host, int port, string authenticationType)

Parameters

host
A string that identifies the host computer.
port
A int that specifies the port to connect to on host.
authenticationType
A string that identifies the authentication scheme used when connecting to host. See Remarks.

Returns

A System.Net.NetworkCredential or, if there is no matching credential in the cache, null.

Remarks

This method searches the System.Net.CredentialCache and returns the System.Net.NetworkCredential instance for the specified host, port, and authorization type. The host, port, and authType values passed to this method are case-insensitively compared to the values specified when the credential was added to the System.Net.CredentialCache using the erload:System.Net.CredentialCache.Add methods.

The supported values for authType are "NTLM", "Digest", "Kerberos", and "Negotiate".

Requirements

Namespace: System.Net
Assembly: System (in System.dll)
Assembly Versions: 2.0.0.0, 4.0.0.0