string URL =
"FILE_URL_PATH";
System.Net.
WebRequest webRequest = System.Net.
WebRequest.Create(URL);
webRequest.Method =
"POST";
webRequest.ContentType =
"application/x-www-form-urlencoded";
Stream reqStream = webRequest.GetRequestStream();
string postData =
"username=YourUser&password=YourPassword";
byte[] postArray =
Encoding.ASCII.GetBytes(postData);
reqStream.Write(postArray, 0, postArray.Length);
reqStream.Close();
StreamReader sr =
new
StreamReader(webRequest.GetResponse().GetResponseStream());
string Result = sr.ReadToEnd();
using (
TextWriter
tw =
new StreamWriter(
"c:\\result.csv",
true))
{
tw.Write(Result);
}