0

I was wondering if can I have custom headers requireds on my web api application.

I don't know too much about headers, http protocols and etc. After reading a little, I thought on required the code for access my application by header. So, the client app need to pass 2 codes on header. It is a good approach?

Can I give any kind of names to my headers? Like "firstCode" and "safeCode"?

When I test my web api from a console application like this:

var request = new HttpRequestMessage();
content.Headers.TryAddWithoutValidation("firstcode", "1");
content.Headers.TryAddWithoutValidation("safecode", "2");
message = client.GetAsync("/Auth?code=" + code).Result;

The webapi receives only one header with the value of both like this: "firstcode:1safecode:2"

4

0 回答 0