HttpRequestMessage和摘要式身份验证 [英] HttpRequestMessage and Digest Authentication

查看:82
本文介绍了HttpRequestMessage和摘要式身份验证的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有任何内置功能将摘要身份验证与winrt中的HttpRequestMessage关联?还是我必须使用其他类才能执行此任务?

Is there any built-in function to associate a digest authentication with an HttpRequestMessage in winrt ? Or do I have to use an other class in order to perfom this task ?

谢谢.

推荐答案

我正在使用 CredentialCache . CredentialCache 应该能够与摘要身份验证一起使用.

I'm using the HttpClient for an HttpRequest Message. The HttpClient constructor accepts a HttpClientHandler, which accepts as Credentials property an instance of CredentialCache. A CredentialCache should be able to work with digest authentication.

代码应类似于:

var credCache = new CredentialCache();
credCache.Add(new Uri("http://.com/"),"Digest", new NetworkCredential(UserName,SecurelyStoredPassword,Domain));
var httpClient = new HttpClient( new HttpClientHandler { Credentials = credCache});
var answer = httpClient.GetAsync(new Uri("http://request.Uri"));

这篇关于HttpRequestMessage和摘要式身份验证的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆