I have the following GET request that returns HTML for a login form, indicating that my authentication, i.e. the credentials are wrong. When I am authenticated in a browser session, and manually request the same URL, I get the expected empty XML document as a response. What am I missing?
var getRequest = WebRequest.Create("http://frulo.com/v1/company/subscribers.xml") as HttpWebRequest;
getRequest.Credentials = new NetworkCredential("user@company.net", "password");
using (var response = getRequest.GetResponse() as HttpWebResponse)
{
var sr = new StreamReader(response.GetResponseStream());
Response.Write(sr.ReadToEnd());
}