NoWar
NoWar

Reputation: 37633

How to read custom header entry of WebClient

Lets say I have

WebClient client = new WebClient();
client.Headers.Set("MyFlag", "12356"); 

How can read "MyFlag" later?

Upvotes: 2

Views: 101

Answers (1)

Jim Mischel
Jim Mischel

Reputation: 133950

Well, Headers is read/write, so you can write:

string value = client.Headers["MyFlag"];

By the way, you can also use this to set the header:

client.Headers["MyFlag"] = "123456";

See WebHeaderCollection documentation.

Upvotes: 3

Related Questions