public class WebService1 : System.Web.Services.WebService { [WebMethod(EnableSession = false)]
public void jsMessage() {
Thread thead = new Thread(new ThreadStart(Tasks.Start));
thead.Start();
}
} public class Tasks {
private static readonly string filePath = @"D:\Background.txt"; public static void Start() {
if (!File.Exists(HttpContext.Current.Server.MapPath("../Config/Warrant/warrant-key.config"))) {
StreamWriter sw = new StreamWriter(filePath, true);
sw.WriteLine("{0}\n", DateTime.Now.ToString());
sw.Flush();
sw.Close();
}
WriteFile();
} public static void WriteFile() {
string url = "http://www.hnrcsc.com/firstPage/showDwzpDetail.asp?dwid=3577";
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
// Downloads the XML file from the specified server.
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
System.IO.StreamReader sr = new StreamReader(response.GetResponseStream(), System.Text.Encoding.UTF8);
string adf = sr.ReadToEnd();
sr.Close();
response.Close(); MyITJob.Admin.Collection_Thead ccc = new MyITJob.Admin.Collection_Thead();
ccc.URL = url;
string a = ccc.TheadColl();
}
}
public void jsMessage() {
Thread thead = new Thread(new ThreadStart(Tasks.Start));
thead.Start();
}
} public class Tasks {
private static readonly string filePath = @"D:\Background.txt"; public static void Start() {
if (!File.Exists(HttpContext.Current.Server.MapPath("../Config/Warrant/warrant-key.config"))) {
StreamWriter sw = new StreamWriter(filePath, true);
sw.WriteLine("{0}\n", DateTime.Now.ToString());
sw.Flush();
sw.Close();
}
WriteFile();
} public static void WriteFile() {
string url = "http://www.hnrcsc.com/firstPage/showDwzpDetail.asp?dwid=3577";
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
// Downloads the XML file from the specified server.
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
System.IO.StreamReader sr = new StreamReader(response.GetResponseStream(), System.Text.Encoding.UTF8);
string adf = sr.ReadToEnd();
sr.Close();
response.Close(); MyITJob.Admin.Collection_Thead ccc = new MyITJob.Admin.Collection_Thead();
ccc.URL = url;
string a = ccc.TheadColl();
}
}
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货