WebRequest WebReq =WebRequest.Create(@"http://www.9630000.com/temp.txt");
WebReq.Method="GET";
WebResponse getWebReq=WebReq.GetResponse();
Stream respStream = getWebReq.GetResponseStream();
StreamReader reader = new StreamReader(respStream, Encoding.ASCII);
string GetDetail= reader.ReadToEnd();
respStream.Close();
GetDetail就是读出来的字符串,写到本地文件中应该会写了吧:)

解决方案 »

  1.   

    WebReq.Method="GET";     // 这句没有必要
      

  2.   

    string remoteUri = "http://www.contoso.com/library/homepage/images/";
    string fileName = "ms-banner.gif", myStringWebResource = null;
    // Create a new WebClient instance.
    WebClient myWebClient = new WebClient();
    // Concatenate the domain with the Web resource filename.
    myStringWebResource = remoteUri + fileName;
    Console.WriteLine("Downloading File \"{0}\" from \"{1}\" .......\n\n", fileName, myStringWebResource);
    // Download the Web resource and save it into the current filesystem folder.
    myWebClient.DownloadFile(myStringWebResource,fileName);        
    Console.WriteLine("Successfully Downloaded File \"{0}\" from \"{1}\"", fileName, myStringWebResource);
    Console.WriteLine("\nDownloaded file saved in the following file system folder:\n\t" + Application.StartupPath);
      

  3.   

    利用.NET框架提供的 WebClient类 和 WebRequest类,我们可以很轻易地得到给定URL地址的源代码《利用WebClient和WebRequest类获得网页源代码》
    http://dotnet.aspx.cc/ShowDetail.aspx?id=0A6660CE-4138-41EF-B882-15DB65564709例子:
    http://dotnet.aspx.cc/Exam/GetPageHtml.aspx