[Mono-devel-list] HTTPS Post

Jeff Tickle jeff at jefftickle.com
Fri Jun 17 10:07:53 EDT 2005


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Not sure if it's a bug or just my lack of understanding of security, but
the fact is, this code works without fail in .NET, but not in Mono:

using System;
using System.IO;
using System.Net;

public class Test {
    public static void Main(string[] args)
    {
        try {
            WebRequest request =
WebRequest.Create("https://api.safepages.com/process.pl");
            request.Method = "POST";
            request.ContentType = "application/x-www-form-urlencoded";
            byte[] bytes =
System.Text.Encoding.UTF8.GetBytes("action=dialup_add&mode=test");
            request.ContentLength = bytes.Length;
            Stream s = request.GetRequestStream();
            s.Write(bytes,0,bytes.Length);
            s.Close();
            Console.WriteLine(new
StreamReader(request.GetResponse().GetResponseStream()).ReadToEnd());
        } catch (WebException e) {
            Console.WriteLine(e);
        }
    }
}

It should return an error saying that the login was invalid.  Instead it
throws an exception, and the stack trace suggests it has to do with a
failure to agree on security.

I did read a bit on certmgr.  I tried importing the certificate of this
particular site, but it wouldn't go anywhere but the AddressBook and
didn't seem to make a difference.

Thanks for any help!

- -Jeff

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFCstk5L5ulKJitYLoRAqj1AJwMbnclw2rju/Vm1Hs1paEBN7SqJACgnErq
QF+8C0d/3cwQtI+RPN4S39c=
=7ui8
-----END PGP SIGNATURE-----



More information about the Mono-devel-list mailing list