The Atlassian Community Forums are currently in read-only mode. We will be relaunching on a new platform on September 22 (read more here). We apologize for the extended downtime. For concerns or questions, please email communitymanagers@atlassian.com. See you on the other side, on the new Atlassian Community Forums! :)

×

Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

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

Andy Kuan
Contributor
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

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

0 votes
Warren
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 Champions.
January 20, 2020

Hi @Andy Kuan 

I use something like this

 try
{
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
Contributor
January 20, 2020

thanks

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_bu=https%3A%2F%2Fzoom.us%2Foauth%2Fauthorize%3Fclient_id%3Du43I1TYkQFiSJsa8zv2Rrg%26response_type%3Dcode%26redirect_uri%3Dhttps%253A%252F%252Fllama.chipsoftindia.com%252Fevents; _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 = "https://api.zoom.us/v2/users/me/meetings";
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;
}