System.Net.CredentialCache Class

Provides storage for multiple credentials.

See Also: CredentialCache Members


public class CredentialCache : IEnumerable, ICredentials, ICredentialsByHost


The System.Net.CredentialCache class stores credentials for multiple Internet resources. Applications that need to access multiple resources can store the credentials for those resources in a System.Net.CredentialCache instance that then provides the proper set of credentials to the Internet resource when required. When the CredentialCache.GetCredential(Uri, string) method is called, it compares the Uniform Resource Identifier (URI) and authentication type provided with those stored in the cache and returns the first set of credentials that match.

The CredentialCache.DefaultCredentials property contains the system credentials of the current security context. For client applications, these represent the user name, password, and domain of the user who is currently logged in. For ASP.NET applications, the default credentials are the user credentials of the logged-in user or the user being impersonated.

Thread Safety

All public static members of this type are safe for multithreaded operations. No instance members are guaranteed to be thread safe.


Namespace: System.Net
Assembly: System (in System.dll)
Assembly Versions: 1.0.x.x, 1.0.5000.0,,