Early Preview
This is currently very much a preview. Please feel free to try things out,
but don't be upset if anything is not yet working. Feedback is welcome over on our
GitHub Dicussions page.
class System.​Net.​CredentialCache
Assembly: System.Net.Primitives
Inheritance: object → CredentialCache
Implemented Interfaces
Provides storage for multiple credentials.
Properties
public static
ICredentials
DefaultCredentials
Gets the system credentials of the application.
public static
NetworkCredential
DefaultNetworkCredentials
Gets the network credentials of the current security context.
Methods
public
void
Add​(string host,
int port,
string authenticationType,
NetworkCredential credential)
Adds a <see cref="T:System.Net.NetworkCredential" /> instance for use with SMTP to the credential cache and associates it with a host computer, port, and authentication protocol. Credentials added using this method are valid for SMTP only. This method does not work for HTTP or FTP requests.
host
A <see cref="T:System.String" /> that identifies the host computer.
port
A <see cref="T:System.Int32" /> that specifies the port to connect to on <paramref name="host" /> .
authenticationType
A <see cref="T:System.String" /> that identifies the authentication scheme used when connecting to <paramref name="host" /> using <paramref name="credential" /> .
credential
The <see cref="T:System.Net.NetworkCredential" /> to add to the credential cache.
public
void
Add​(Uri uriPrefix,
string authType,
NetworkCredential cred)
Adds a <see cref="T: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.
uriPrefix
A <see cref="T:System.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 <paramref name="uriPrefix" /> .
cred
The <see cref="T:System.Net.NetworkCredential" /> to add to the credential cache.
public
NetworkCredential
GetCredential​(string host,
int port,
string authenticationType)
Returns the <see cref="T:System.Net.NetworkCredential" /> instance associated with the specified host, port, and authentication protocol.
Returns A <see cref="T:System.Net.NetworkCredential" /> or, if there is no matching credential in the cache, <see langword="null" /> .
host
A <see cref="T:System.String" /> that identifies the host computer.
port
A <see cref="T:System.Int32" /> that specifies the port to connect to on <paramref name="host" /> .
authenticationType
A <see cref="T:System.String" /> that identifies the authentication scheme used when connecting to <paramref name="host" /> .
public
NetworkCredential
GetCredential​(Uri uriPrefix,
string authType)
Returns the <see cref="T:System.Net.NetworkCredential" /> instance associated with the specified Uniform Resource Identifier (URI) and authentication type.
Returns A <see cref="T:System.Net.NetworkCredential" /> or, if there is no matching credential in the cache, <see langword="null" /> .
uriPrefix
A <see cref="T:System.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 <paramref name="uriPrefix" /> .
GetEnumerator​()
Returns an enumerator that can iterate through the <see cref="T:System.Net.CredentialCache" /> instance.
Returns An <see cref="T:System.Collections.IEnumerator" /> for the <see cref="T:System.Net.CredentialCache" /> .
public
void
Remove​(string host,
int port,
string authenticationType)
Deletes a <see cref="T:System.Net.NetworkCredential" /> instance from the cache if it is associated with the specified host, port, and authentication protocol.
host
A <see cref="T:System.String" /> that identifies the host computer.
port
A <see cref="T:System.Int32" /> that specifies the port to connect to on <paramref name="host" /> .
authenticationType
A <see cref="T:System.String" /> that identifies the authentication scheme used when connecting to <paramref name="host" /> .
public
void
Remove​(Uri uriPrefix,
string authType)
Deletes a <see cref="T:System.Net.NetworkCredential" /> instance from the cache if it is associated with the specified Uniform Resource Identifier (URI) prefix and authentication protocol.
uriPrefix
A <see cref="T:System.Uri" /> that specifies the URI prefix of the resources that the credential is used for.
authType
The authentication scheme used by the host named in <paramref name="uriPrefix" /> .
public
bool
Equals​(object obj)
Inherited from object
protected
void
Finalize​()
Inherited from object
public
int
GetHashCode​()
Inherited from object
protected
object
MemberwiseClone​()
Inherited from object
public
string
ToString​()
Inherited from object