Lets say I have

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

How can read "MyFlag" later?

有帮助吗?

解决方案

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.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top