Forum Xamarin.Android

Does Xamarin supports to login SharePoint protected with Windows based authentication( NTLM )?

ErucyErucy CNMember ✭✭
edited September 2013 in Xamarin.Android

Hi,

I'm developing an app to access SharePoint on Android using the lasted version of Mono for Android.
I writed the following codes to do it:

System.Net.CredentialCache MyCredentialCache = new System.Net.CredentialCache();
MyCredentialCache.Add(new System.Uri(xsnUrl), "NTLM",
new System.Net.NetworkCredential(@username, "password", "domain"));

HttpWebRequest req = (HttpWebRequest)HttpWebRequest.Create(url);
req.Method = "GET";
req.KeepAlive = true;
req.PreAuthenticate = true;
req.Credentials = MyCredentialCache;
HttpWebResponse response = (HttpWebResponse)req.GetResponse();
Stream responseStream = response.GetResponseStream();

I tested it with SharePoint Server 2007 on windows 2003 R2 SP2, with interageted windows authentication.
The codes works fine in WinForm, but throws 401.1 exception at the last line on Android Emulator.

I found a thread on stackoverflow mentioned that Mono supports NTLM:
http://stackoverflow.com/questions/8235141/monotouch-support-for-accessing-mono-security-protocol-ntlm-ntlmflags
But while I run the same codes in a Mono 3.2.3 console application, it throws 401.1 exception also. Thank you.

Answers

Sign In or Register to comment.