AMH
AMH

Reputation: 6451

The remote server returned an error (400)

I got bad request using the following Code :

HttpWebRequest request = (HttpWebRequest)WebRequest.Create(@"https://xxxxxxx");
            request.Headers.Add("xxxxxxxxxxxxxxxxx");
            request.ContentType = "application/x-www-form-urlencoded ";
            request.Method = "POST";
            byte[] buf = Encoding.Default.GetBytes("sssssssssssssss");
            request.ContentLength = buf.Length;
            request.GetRequestStream().Write(buf, 0, buf.Length);
            using (var response = (HttpWebResponse)request.GetResponse())
            {

}

am I missing something in the configuration

Upvotes: 0

Views: 57

Answers (1)

Danny Cullen
Danny Cullen

Reputation: 1832

Assuming https://xxxxxxx is valid in the browser and the SSL certificate is valid, you may need to pass correct headers like User-Agent if you haven't already.

Upvotes: 2

Related Questions