[Mono-list] Help with SSL and WebRequest

John M. Brown ratchet at firelace.com
Fri Aug 19 16:53:29 EDT 2005


I continually get this error when I try to use the System.Net.WebRequest
class to connect to an SSL Server.

My setup: Using Debian (with MonoDevelop) and Mono 1.1.8-2.

Here's the full error:

Unhandled Exception: System.Net.WebException: Error writing request.
in <0x0020d> System.Net.WebConnectionStream:WriteRequest ()
in (wrapper remoting-invoke-with-check)
System.Net.WebConnectionStream:WriteRequest ()
in <0x00147> System.Net.WebConnectionStream:Close ()
in [0x0023a] (at /home/ratchet/mono/testcsharp/TEST/FileUpload.cs:91)
FileUpload:UploadFileEx (System.String uploadfile, System.String url,
System.String fileFormName, System.String contenttype, System.String
querystring)
in [0x00011] (at /home/ratchet/mono/testcsharp/TEST/FileUpload.cs:19)
FileUpload:Upload ()
in [0x00011] (at /home/ratchet/mono/testcsharp/TEST/Main.cs:55)
SimpleApp:button_Clicked (System.Object sender, System.EventArgs e)
in (wrapper delegate-invoke)
System.MulticastDelegate:invoke_void_object_EventArgs
(object,System.EventArgs)
in <0x00096> GLib.Signal:voidObjectCallback (IntPtr handle, IntPtr gch)
in (wrapper native-to-managed) GLib.Signal:voidObjectCallback (intptr,intptr)
in <0x00000> <unknown method>
in (wrapper managed-to-native) Gtk.Application:gtk_main ()
in <0x00007> Gtk.Application:Run ()
in [0x000a6] (at /home/ratchet/mono/testcsharp/TEST/Main.cs:31)
SimpleApp:Main ()

I ran the tlstest.exe file from: http://www.mono-project.com/FAQ:_Security
and it gives me some data but the last line reads:

"Error #-2146762486: CERT_E_CHAINING 0x800B010A"

...

I've connected and written the request (which works on Microsoft's .Net
CLR) but when I go to "WebRequest.Flush()" and "WebRequest.Close()" it
dies.

I read in a mailing in June that I may be able to get around this by
trusting the certificate, but alas the FAQ page doesn't provide much in
the way of details except to say "you need to find the public
certificate".

Can anyone provide a work around or tell me what I'm doing wrong... or
even give me some direction in how to set up trust against either an
individual or blanketed trust to all certificates?

Here's a snippet...

...
requestStream.Write(boundaryBytes, 0, boundaryBytes.Length);
requestStream.Flush();
requestStream.Close();
WebResponse resp = webrequest.GetResponse();
StreamReader sr = new StreamReader(s);
return sr.ReadToEnd();


Let me repeat again for clarity.  My program works correctly on
Microsoft's .Net CLR on Windows, but fails when run through Mono.  The
site I'm connecting to for an example is https://www.ipupdater.com

Thanks,

John M. Brown



More information about the Mono-list mailing list