Quite a simple problem I've got that would be easy to solve I reckon for the brains. It's just a tried a different queries on Google and nothing popped up but hey that's why I am here.
Here is the error: System.InvalidOperationException
Basically this error is thrown on this piece of code here
string test = response.Content.Headers.GetValues("Location").FirstOrDefault();
Location in Fiddler looks like this:
Location: https://www.redirecturlishere.com/blah
Here is the entire function:
private async Task<string> GetRequest()
{
//HttpContent postContent = new StringContent(post, Encoding.ASCII, "application/x-www-form-urlencoded");
using (HttpResponseMessage response = await httpClient.GetAsync(
"http://www.cant-share-url.com"))
{
using (HttpContent content = response.Content)
{
string test = response.Content.Headers.GetValues("Location").FirstOrDefault();
}
}
return "";
}
More details on the error, "Additional information: Misused header name. Make sure request headers are used with HttpRequestMessage, response headers with HttpResponseMessage, and content headers with HttpContent objects."
I don't think there is much else to explain so I'll leave it at that.