如何获得在C#中网页的最后修改日期? [英] How to get last modified date of the webpage in c#?

查看:108
本文介绍了如何获得在C#中网页的最后修改日期?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道如何使用C#...?

I want to know how to get last modified date of the webpage using c#...?

我试过下面的代码来获取网页的最后修改日期,但我只得到日期为今天

I tried the below code but I get only date as today

HttpWebRequest req =(HttpWebRequest)WebRequest.Create("http://www.codeproject.com/KB/cs/youmanager.aspx");
HttpWebResponse res =(HttpWebResponse) req.GetResponse();
DateTime  abcd = res.LastModified;



先谢谢了。

Thanks in advance.

推荐答案

根据这个你的方法应该工作。也许该网页实际上今天修改?

According to this your method should work. Maybe the page was actually modified today?

也在寻找这种反应这里它是由HTTP服务器设置Last-Modified响应报头。因此,如果服务器没有正确设置字段,你不能依赖于它。

Also looking at this response here it is up to the HTTP server to set the Last-Modified response header. So if the server does not set the field correctly you can't rely on it.

这篇关于如何获得在C#中网页的最后修改日期?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆