Ryan H
Ryan H

Reputation: 359

WebClient Headers property missing Add method?

In .NET (for Windows Phone), I'm trying to use the WebClient class to send XML to a web service. The examples I found modify add headers with an Add method, but I am getting an error that the Add method could not be found:

using System.Net;
...
WebClient wc = new WebClient();
wc.Headers.Add(HttpRequestHeader.ContentType, "text/xml");

Am I just missing a reference somewhere or has this been changed? I also don't have a Set method listed either.

Upvotes: 4

Views: 1665

Answers (1)

Roman Golenok
Roman Golenok

Reputation: 1417

wc.Headers["ContentType"] = "text/xml";

Upvotes: 3

Related Questions