درود بر تمامی برنامه نویسان ایران زمین امروز ، کد دریافت فایل متنی از وب با سی شارپ c#.net رو براتون قرار دادم.انشاالله که این آموزش به دردتون بخوره و مورد استفاده قرارش بدهید
using System.Net;
using System.IO;
WebRequest request = FileWebRequest.Create("http://www.program98.com/a.txt");
WebResponse response = request.GetResponse();
string LocalPath = "C:\\filename.txt";
byte[] buffer = new byte[response.ContentLength];
response.GetResponseStream().Read(buffer,0,Convert.ToInt32(response.ContentLength));
FileStream fs = new FileStream(LocalPath, FileMode.Create, FileAccess.Write);
fs.Write(buffer,0,Convert.ToInt32(buffer.Length));
response.Close();
fs.Close();
using System.IO;
WebRequest request = FileWebRequest.Create("http://www.program98.com/a.txt");
WebResponse response = request.GetResponse();
string LocalPath = "C:\\filename.txt";
byte[] buffer = new byte[response.ContentLength];
response.GetResponseStream().Read(buffer,0,Convert.ToInt32(response.ContentLength));
FileStream fs = new FileStream(LocalPath, FileMode.Create, FileAccess.Write);
fs.Write(buffer,0,Convert.ToInt32(buffer.Length));
response.Close();
fs.Close();