3

I am working on a Windows 10 UWP app that needs to talk to a IIS server using NTLM authentication. I am setting the username and password in the HttpBaseProtocolFilter:

filter.ServerCredential = new PasswordCredential(uri, UserName, Password);

When i view the request in fiddler, it is using Basic Auth. Is there anything I can do to get it to use NTLM, which the server is requiring?


Request Headers:

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

Response Headers:

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
2
  • Your code works for me with NTLM. Can you post the previous Fiddler requests and responses? Commented Dec 6, 2015 at 1:06
  • One note: I am setting the username for the password credential in the form: {domain}\{username} Commented Dec 7, 2015 at 15:49

1 Answer 1

1

Short answer: NTLM auth does work with username / password. Need to retry the connection a second time, because HttpClient is pre-sending BASIC auth when server wants NTLM

Long answer: My app contacts two services hosted on the same server. The first allows Basic auth but the second only allows NTLM. First I connected to the Basic auth service and then I connect to the NTLM one. I would assume the HttpClient would have automatically performed a retry with NTLM when it got the WWW-Authenticate: NTLM header, but it appears that it doesn't. However, if I manually retry the connection, then the second time the HttpClient will perform NTLM auth.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.