且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

HTTPS和放大器;摘要式身份验证

更新时间:2023-12-03 10:29:22

您可以创建在的 CredentialCache 时,其用于Web客户和WebRequests。因此,例如,以填充CredentialCache尝试文摘AUTH可以使用

You can specify the type of credential when creating a credential in the CredentialCache, which is used for WebClients and WebRequests. So, for example, to populate the CredentialCache to try Digest auth you could use

CredentialCache cache = new CredentialCache();
Uri prefix = new Uri ("http://www.example.com");
cache.Add (prefix, "Digest",  new NetworkCredential ("username", "passwd"));

WebClient wc = new WebClient();
wc.Credentials = cache;

由于摘要式身份验证依赖于目标URL和领域,如果它指定一个你需要让这些权利。

As digest authentication is dependant on the destination URL, and the realm if it specifies one you do need to get those right.