I am trying to make a cURL call to download a CSV file and I'm getting back the login page html. Here is the code:
WebRequest myRequest = WebRequest.Create("https://website.com/medias/823533/events.csv");
myRequest.Credentials = new NetworkCredential("username", "password");
myRequest.Method = "GET";
myRequest.PreAuthenticate = true;
// Return the response.
WebResponse myResponse = myRequest.GetResponse();
StreamReader sr = new StreamReader(myResponse.GetResponseStream());
string result = sr.ReadToEnd();
sr.Close();
Console.WriteLine(result);
Console.ReadLine();
Is there a simple cURL method in C#? This doesn't seem to be working no matter what I try.