现在的位置: 首页 > 综合 > 正文

c#获取远程文件更新时间

2012年08月24日 ⁄ 综合 ⁄ 共 545字 ⁄ 字号 评论关闭
            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);
            };

 

抱歉!评论已关闭.