jareyes2024
New member
- Joined
- Feb 13, 2024
- Messages
- 2
- Programming Experience
- Beginner
I'm making a call to an API and I can't find the source of this error "Specified Cast is not valid"
C#:
var client = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Get, UrlApi);
request.Headers.Add("Accept", "text/plain");
request.Headers.Add("Authorization", $"Bearer {App.TokenLoged}");
//when this line is executed it gives me the error
var response = await client.SendAsync(request);
response.EnsureSuccessStatusCode();
Console.WriteLine(await response.Content.ReadAsStringAsync());
Last edited by a moderator: