System.Net.CredentialCache.Add Method

Adds a System.Net.NetworkCredential instance to the credential cache for use with protocols other than SMTP and associates it with a Uniform Resource Identifier (URI) prefix and authentication protocol.

Syntax

public void Add (Uri uriPrefix, string authType, NetworkCredential cred)

Parameters

uriPrefix
A Uri that specifies the URI prefix of the resources that the credential grants access to.
authType
The authentication scheme used by the resource named in uriPrefix.
cred
The System.Net.NetworkCredential to add to the credential cache.

Exceptions

TypeReason
ArgumentNullExceptionThe uriPrefix or authType parameter is null.
ArgumentExceptionThe cache already contains a credential for the specified uriPrefix and authType.

Remarks

The CredentialCache.Add(Uri, string, NetworkCredential) method places a System.Net.NetworkCredential instance for use with protocols other than SMTP into the System.Net.CredentialCache. The cache stores credentials in the order in which they are added to it. When the CredentialCache.GetCredential(Uri, string) method is called, it returns the proper matching System.Net.NetworkCredential instance.

Requirements

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