Forums

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

await client.SendAsync(request) CRASH

Marc Jeeves
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!
February 21, 2023

I'm trying to download an attachment but as soon as the SendAsync(request) is made i get a hard crash of visual studio

 

thanks

Marc

 

public static async Task<bool> DownloadTaskAttachmentAsync(string attachmentId, string localDirectory)
{
try
{
var client = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Get, "https://nikolamotor.atlassian.net/rest/api/3/attachment/content/177400");
request.Headers.Add("Authorization", "Basic BLAHBlahBLAHBlahBLAHBlahBLAHBlah");
request.Headers.Add("Cookie", "atlassian.xsrf.token=addBLAHBlahBLAHBlah_lin");
var response = await client.SendAsync(request);
response.EnsureSuccessStatusCode();
Console.WriteLine(await response.Content.ReadAsStringAsync());
return true;
}
catch(Exception ex)
{
Console.Write(ex.Message);
return false;
}
}

0 answers

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
STANDARD
TAGS
AUG Leaders

Atlassian Community Events