0
我用下面的代碼有錯誤的請求:遠程服務器返回錯誤(400)
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())
{
}
我會在配置
什麼是useragent請 – AMH
用戶代理基本上是告訴網絡服務器你是誰。這是由您的瀏覽器設置的。用戶代理:Mozilla/5.0應該足夠了。 –
仍然是同樣的問題 – AMH