c#获取远程文件更新时间
HttpWebRequest myReq = (HttpWebRequest)WebRequest.Create("http://www.moreyun.com/2012/shangxiabangao_0805/144.html"); HttpWebResponse myRes = (HttpWebResponse)myReq.GetResponse(); WebHeaderCollection header = myRes.Headers; string lastmodify = header["Last-Modified"]; myRes.Close();
或
string url = "http://www.moreyun.com/2012/shangxiabangao_0805/144.html"; Uri uri = new Uri(url, UriKind.Absolute); WebClient request = new WebClient(); request.OpenReadAsync(uri); request.OpenReadCompleted += (s, ev) => { string last = request.ResponseHeaders["Last-Modified"]; MessageBox.Show(last); };
作者:王春明
出处:http://wangchunming.cnblogs.com/
本文版权归作者和博客园共有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接,否则保留追究法律责任的权利。