I'm using Mono 2.6.7 - if I don't specify a Domain the requested Host is taken for the NTLM Authentication - which leads to an unsuccessful login.
1 - Working: Login with Username 'domainXYZ/User123' -> Wireshark Capture of NTLM Packages:
Domain name: domainXYZ
User name: User123
2 - Working: Login with Username 'User123' on URL http://1.2.3.4/a.txt -> .Net/Windows:
Domain name: NULL
User name: User123
3 - Not Working: Login with Username 'User123' on URL http://1.2.3.4/a.txt -> Mono/Debian:
Domain name: 1.2.3.4
User name: User123
This authentication request is not working, because there is no Domain called 1.2.3.4 on the target machine.
My code for authentication without Domain information:
NetworkCredential credential = new NetworkCredential(request.Username, request.Password);
// credential = new NetworkCredential(request.Username, request.Password, null); also not working
CredentialCache credentialCache = new CredentialCache { { new Uri(request.Url), "NTLM", credential } 开发者_C百科};
webClient.Credentials = credentialCache;
Any ideas?
We were able to do a "simple" workaround to solve the domain issue. In general, we implemented the connection as a "fat" static library in Objective-C, using the ASIHTTPRequest framework for simplicity, did the API binding as described here, and with some help from here, we were able to include the created .dll and .a file into MonoDevelop and link against the needed frameworks.
Feel free to contact me, if you're interested in the source files. I also have some more interesting links that helped us, but I need some more reputation to post them. Also, feel free to ask me for them.
Regards, Andreas
Edit: Sorry, the most important information was missing. Setting the domain in ASIHTTPRequest to an empty string [asiRequest setDomain:@""];
and wrapping the whole request in the static library did the trick.
I have just fixed this problem in the Mono master and mono-2-10 branches: https://github.com/mono/mono/commit/214741630f96ddd3e847ff4050182674fe2d1602
精彩评论