CredentialCache 建構函式
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
建立 CredentialCache 類別的新執行個體。
public:
CredentialCache();
public CredentialCache ();
Public Sub New ()
範例
下列程式代碼範例會 CredentialCache 使用多個安全性認證初始化 ,並使用那些認證搭配 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
備註
建構函式會 CredentialCache 建立 實例。