CredentialCache Constructor
Collapse the table of content
Expand the table of content

CredentialCache Constructor ()


Creates a new instance of the CredentialCache class.

Namespace:   System.Net
Assembly:  System (in System.dll)

public CredentialCache()

The constructor creates a CredentialCache instance.

The following code example initializes a CredentialCache with multiple security credentials and uses those credentials with a WebRequest.

CredentialCache myCache = new CredentialCache();

myCache.Add(new Uri(""),"Basic",new NetworkCredential(UserName,SecurelyStoredPassword));
myCache.Add(new Uri(""),"Digest", new NetworkCredential(UserName,SecurelyStoredPassword,Domain));

wReq.Credentials = myCache;

Universal Windows Platform
Available since 4.5
.NET Framework
Available since 1.1
Portable Class Library
Supported in: portable .NET platforms
Windows Phone Silverlight
Available since 8.1
Windows Phone
Available since 8.1
Return to top
© 2015 Microsoft