我正在开发一款Windows 10 UWP应用,需要使用NTLM身份验证与IIS服务器通信。我在HttpBaseProtocolFilter中设置了用户名和密码:
请求头:
filter.ServerCredential = new PasswordCredential(uri, UserName, Password);
但是,当我在Fiddler中查看请求时,它使用的是基本身份验证。有什么办法可以让它使用服务器要求的NTLM身份验证呢?
请求头:
Content-Length: 1459
Content-Type: text/xml; charset=utf-8
Host: server
Connection: Keep-Alive
Cache-Control: no-cache
Cookie: ClientId=XXXXXXXXX
Authorization: Basic XXXXXXXXX
响应头:
HTTP/1.1 401 Anonymous Request Disallowed
Server: Microsoft-IIS/8.5
request-id: xxxxx
WWW-Authenticate: NTLM
WWW-Authenticate: Negotiate
X-Powered-By: ASP.NET
X-FEServer: XXXXXXX
Date: Thu, 03 Dec 2015 16:12:58 GMT
Content-Length: 0
Proxy-Support: Session-Based-Authentication
{domain}\{username}
的形式设置密码凭据的用户名。 - Michael Sabin