How to submit https form using C#
===

I am creating a C#/.NET app to automatically reconnect to a wifi hotspot. The Internet access detection works fine but I can't reconnect. The wifi hotspot uses an HTTPS POST login form.

I tried several suggestions from stackoverflow but nothing worked so far: the answer I get from my request is the login page and I am not connected to the Internet.

I tried:

    
    public class Hotspot
    {
        public string Url { get; set; }
        public string Method { get; set; }
        public string Inputs { get; set; }

        public HttpStatusCode Connect()
        {
            HttpWebRequest request = (HttpWebRequest)WebRequest.Create(this.Url);
            request.KeepAlive = false;
            request.ProtocolVersion = HttpVersion.Version10;
            request.Method = this.Method;

            ServicePointManager.ServerCertificateValidationCallback += new RemoteCertificateValidationCallback(delegate(object sender, X509Certificate certificate, X509Chain chain, SslPolicyErrors sslPolicyErrors) { return true; });

            byte[] post_bytes = Encoding.ASCII.GetBytes(this.Inputs);
            request.ContentType = "application/x-www-form-urlencoded";
            request.ContentLength = post_bytes.Length;
            using (Stream requestStream = request.GetRequestStream())
            {
                requestStream.Write(post_bytes, 0, post_bytes.Length);
            }

            HttpWebResponse response = (HttpWebResponse)request.GetResponse();
            Console.WriteLine(new StreamReader(response.GetResponseStream()).ReadToEnd());
            Console.WriteLine(response.StatusCode);
            return response.StatusCode;
        }

        public void Connect2()
        {
            using (WebClient client = new WebClient())
            {
                client.Headers.Add(HttpRequestHeader.ContentType, "text/xml");
                System.Text.ASCIIEncoding encoding = new System.Text.ASCIIEncoding();
                byte[] response = client.UploadData(this.Url, "POST", encoding.GetBytes(this.Inputs));
                Console.WriteLine(encoding.GetString(response));
            }
        }
    }

- this.Url looks like @"https://hotspot.somtehing.com/nb4_crypt.php"
- this.Method is "POST"
- this.Inputs is a string representing all of the inputs with their value (like @"username=me&password=something&conditions=on&blablah=")

Both method output the login page and I am still not connected to the Internet. The first method (Connect) returns 200.
I checked the input values and they're correct: I can connect using a web browser.