Sekhmet
Sekhmet

Reputation: 533

HttpURLConnection and HttpWebRequest

I need class like HttpURLConnection in Java.
I can use HttpWebRequest but I need method like that

HttpURLConnection connection = (HttpURLConnection)new URL(requestURL).openConnection();
for (Property p : property)
    connection.addRequestProperty(p.key, p.value); //HttpWebRequest have that?
connection.connect();

Any ideas?

Upvotes: 1

Views: 7981

Answers (1)

Jon Skeet
Jon Skeet

Reputation: 1500913

You want the WebRequest.Headers property:

request.Headers["name"] = value;

Upvotes: 4

Related Questions