CredentialCache CredentialCache CredentialCache Constructor

Definition

Erstellt eine neue Instanz der CredentialCache-Klasse.Creates a new instance of the CredentialCache class.

public:
 CredentialCache();
public CredentialCache ();
Public Sub New ()

Beispiele

Im folgenden Codebeispiel wird ein CredentialCache mit mehreren Sicherheits Anmelde Informationen initialisiert und diese Anmelde Informationen mit einer WebRequestverwendet.The following code example initializes a CredentialCache with multiple security credentials and uses those credentials with a WebRequest.

CredentialCache^ myCache = gcnew CredentialCache;

myCache->Add( gcnew Uri( "http://www.contoso.com/" ), "Basic", gcnew NetworkCredential( UserName,SecurelyStoredPassword ) );
myCache->Add( gcnew Uri( "http://www.contoso.com/" ), "Digest", gcnew NetworkCredential( UserName,SecurelyStoredPassword,Domain ) );

wReq->Credentials = myCache;
CredentialCache myCache = new CredentialCache();

myCache.Add(new Uri("http://www.contoso.com/"),"Basic",new NetworkCredential(UserName,SecurelyStoredPassword));
myCache.Add(new Uri("http://www.contoso.com/"),"Digest", new NetworkCredential(UserName,SecurelyStoredPassword,Domain));

wReq.Credentials = myCache;
Dim myCache As New CredentialCache()

myCache.Add(New Uri("http://www.contoso.com/"), "Basic", New NetworkCredential(UserName, SecurelyStoredPassword))
myCache.Add(New Uri("http://www.contoso.com/"), "Digest", New NetworkCredential(UserName, SecurelyStoredPassword, Domain))

wReq.Credentials = myCache

Hinweise

Der-Konstruktor erstellt CredentialCache eine-Instanz.The constructor creates a CredentialCache instance.

Gilt für: