I have a winrt app and a Windows.Web.Http.HttpClient
I want to set its Authorization header without using a scheme. My code is as below.
HttpClient client = new HttpClient();
client.DefaultRequestHeaders.Authorization = new HttpCredentialsHeaderValue("Scheme", "mytoken");
This will result in this Authorization: Scheme mytoken
What I want is this Authorization: mytoken
The problem is that the Constuctor of HttpCredentialsHeaderValue
has to take a scheme argument and that scheme cannot be String.empty
Is there a way I can achieve this result?
Try:
HttpClient client = new HttpClient();
client.DefaultRequestHeaders.TryAppendWithoutValidation(
"Authorization",
"mytoken");