Reputation: 18794
I need to set the Authorization header for Amazon SQS but it requires multiple values.
When setting the header I get an exception thrown:
System.FormatException : Cannot add value because header 'Authorization' does not support multiple values.
How can I set the header with multiple values separated by a comma.
Upvotes: 1
Views: 2362
Reputation: 18794
I worked it out, solution is to assign it to the Authorization property.
string authorize = "Credential=.../sqs/aws4_request, SignedHeaders=host;user-agent;x-amz-date, Signature=....";
Given the entire string, which contains multiple values:
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("AWS4-HMAC-SHA256", authorize);
Assign it to the Authorization property.
This solved the problem.
Upvotes: 4