how to see the details of "The remote server returned an error: (400) Bad Request." in C#

Andy Kuan January 17, 2020

how to see the details of "The remote server returned an error: (400) Bad Request." in C#?

I can only see the 400 Bad Request. it didn't see anything more.  not like curl command line.

1 answer

0 votes
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 20, 2020

Hi @Andy Kuan 

I use something like this

HttpWebResponse response = newRequest.GetResponse() as HttpWebResponse;
catch (WebException we)
Stream stream = we.Response.GetResponseStream();
StreamReader sr = new StreamReader(stream);
string strMessage = sr.ReadToEnd();

where strMessage in the catch area has the details of the error

Andy Kuan January 20, 2020


Anshul Yadav
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
May 6, 2024

how to resolve to same problem that The remote server returned an error: (400) Bad Request. please suggest me please


using (var client = new WebClient())
client.Headers.Add("Content-Type", "application/json");
client.Headers.Add("Accept", "application/json");
client.Headers.Add("Authorization", "Bearer " + zoomaccesstoken);
client.Headers.Add("Cookie", "TS018dd1ba=0135c3e7ce5af3c1d80c8393d3120501505b8aadaca541beb2e6d62b1f1da9b1441b760b42bf222ddd1493fee22214af1420d169d9; __cf_bm=C2EMhl36Jhy4brGh7fyNUEeopvY.IlkwBQ2giNgFLmM-1687411236-0-ATNLVGTGqXEhNj277g/f/YPcO9CKi0Vy4wZhOoyCjd0zFzc/UTi7Mb5F8Js4e1NI61Lt8qyCslwqtfsja7CUa3w=;; _zm_chtaid=227; _zm_csp_script_nonce=3bKSprXfRt-w43ms6EIKtg; _zm_ctaid=rUdyvPO5RBWjBY6DUrAhng.1687411621553.c30f0b05e5d4e06c7ba6d1d8f9a7df0b; _zm_currency=INR; _zm_mtk_guid=1ac74555fe124cba86040a3823958b17; _zm_o2nd=e2cf1797f4054b67a7ba12eef8bf61e3; _zm_page_auth=us06_c__QD3j4hgRpGjzq4hErlwLg; _zm_ssid=us06_c_L-GD3UBuQIC8UtHjjtVl9A; _zm_visitor_guid=1ac74555fe124cba86040a3823958b17; TS01f92dc5=0135c3e7ce5af3c1d80c8393d3120501505b8aadaca541beb2e6d62b1f1da9b1441b760b42bf222ddd1493fee22214af1420d169d9; cred=9ABFCDDEC25356B8ED9F76D6F0901190");

var url = "";
var body = @"{
""pre_schedule"": false,
""start_time"": """ + timeFromUTC + @""",
""timezone"": ""UTC"",
""topic"": """ + topic + @""",
""type"": 2

var response = client.UploadString(url, "POST", body);

ZoomCreateMeeting objCM = Newtonsoft.Json.JsonConvert.DeserializeObject<ZoomCreateMeeting>(response);
return objCM;

Suggest an answer

Log in or Sign up to answer