[Mono-list] Authenticating against an NTLM only server using HttpWebRequest/NetworkCredential

David Kennedy davepkennedy at gmail.com
Fri Jan 5 12:49:32 EST 2007


I have a small program (should be attached) which tries to download a
file from a server running IIS/SharePoint. If I compile this with mcs
and run it with .Net, the file is downloaded from the server and
displays in the console. If I run it with Mono, the request is

I've had a look around and found some things similar, but I haven't
seen any solutions to this. Is there a way to authenticate with a
server with NTLM, or can it only be Basic/Digest/Kerberos?

-------------- next part --------------
using System;
using System.IO;
using System.Net;
using System.Collections;

namespace GetServerData
	class Program
		static void Main(string[] args)
				HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create ("http://testserver/_vti_inf.html");
				request.Credentials = new NetworkCredential ("user", "pass");
				WebResponse response = request.GetResponse ();
				using (Stream stream = response.GetResponseStream ())
				using (StreamReader reader = new StreamReader (stream))
					Console.WriteLine (reader.ReadToEnd ());
			catch (Exception err)
				Console.WriteLine (err);

More information about the Mono-list mailing list