日期:2014-05-20 浏览次数:20870 次
//提供url路径,并下载到本地 WebRequest request = WebRequest.Create("http://222.35.76.37/Download/XMLFile.xml"); request.Method = "get"; WebResponse response = request.GetResponse(); Stream s = response.GetResponseStream(); StreamReader readerNew = new StreamReader(s, Encoding.Default); string xml = readerNew.ReadToEnd(); response.Close(); File.WriteAllText(Application.StartupPath + @"\XMLFile.xml", xml); //保存到本地