CredentialCache コンストラクタ
アセンブリ: System (system.dll 内)
構文
解説
使用例
複数のセキュリティ資格情報で CredentialCache を初期化し、それらの資格情報を WebRequest で使用するコード例を次に示します。
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 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;
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.set_Credentials(myCache);
Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。
参照
- CredentialCache コンストラクタのページへのリンク