[Mono-list] Accessing secure site: x509 + basic authentication
Tue, 02 Nov 2004 07:51:33 -0500
Some comments below. Please fill a bug report into bugzilla.ximian.com.
> I'm attempting to access a secured site using Mono, the site uses
> certification (https) and basic authentication.
Are you using client-side certificates ? or only server-side ?
If you're using client-side (like your code seems to) then why do you need a
> When running my code I'm given the result:
> Error getting response stream: ReceiveFailure
You probably get a stack trace with an exception ?
Could you add this in your bug report.
> After various attempts I decided to test the same code on SharpDevelop
> with the MS Framework v1.1, this compiled fine and works (ie I get the
> correct response from the server). This suggests to me that the code is
> fine however it's a bug relating to Mono?? Or am I deluding myself :S
> The code doesn't get as far as 'Console.WriteLine("Got Response");'
> Any advice appreciated!
> << Code Snippet >>
> // Service Point
> ServicePointManager.CertificatePolicy = new MyPolicy();
> HttpWebRequest webRequest = (HttpWebRequest)
> // Crendential Cache
> credentialcache.Add(new Uri("https://www.securesite.com/login"), "Basic",
> new System.Net.NetworkCredential("user", "password"));
> webRequest.Credentials = crendentialcache;
> X509Certificate x509 =
You only have to supply a certificate for client-side SSL authentication.
If this is the case then the code is incomplete for Mono - as Mono has no
way to "detect" the private key associated with the certificate.
> System.Net.HttpWebResponse response =
> Console.WriteLine("Got GetResponse");
> System.IO.StreamReader reader = new
> string HTML = reader.ReadToEnd();
> Mono-list maillist - Monofirstname.lastname@example.org