我需要为Win Auth
模拟HttpClient
http标头。它可能类似于以下内容,请参阅Authorization
标题:
POST http://url HTTP/1.1
Host: http://127.0.0.1/
User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:43.0) Gecko/20100101 Firefox/43.0
Accept: /
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate
Content-Type: application/x-www-form-urlencoded; charset=UTF-8
Referer: http://127.0.0.1/
Content-Length: 18
Origin: http://127.0.0.1/
Connection: keep-alive
Authorization: NTLM TlRMTVNTUAADAAAAGAAYAIQAAABuAW4BnAAAAAAAAABYAAAAFgAWAFgAAAA
WABYAbgAAAAAAAAAKAgAABYKIogoAACgAAAAPUOVvBWOMBKcZqtqFzf+fmWQAZwByAHUAZAB6AGkAbgBzA...
请举例说明如何编码域用户名&该http标头的密码,我只找到BASIC
身份验证的示例。但有windows authentication
& NTLM
。
答案 0 :(得分:0)
将域凭据放在HttpClientHandler.Credentials属性中,AuthorizationManager将为您进行Auth舞蹈,并根据需要填写授权标题。