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);
            };

 

posted @ 2012-08-11 23:00  王春明  阅读(1140)  评论(0编辑  收藏  举报