开发者

How to get last modified date of the webpage? [duplicate]

开发者 https://www.devze.com 2023-03-12 23:56 出处:网络
This question already has answers here:开发者_开发知识库 HttpWebResponse LastModified (2 answers)
This question already has answers here: 开发者_开发知识库 HttpWebResponse LastModified (2 answers) Closed 2 years ago.

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?

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消