Last post Apr 07, 2010 09:15 PM by Gary Frank
Apr 06, 2010 03:25 PM|Gary Frank|LINK
I would like to add code in a program that determines when a website was last updated. Ideally you would give the code a URL of a website and it would return a DateTime that the website was last updated. Is there a way to do this using .NET -- and do it
Apr 06, 2010 06:17 PM|Bruce L|LINK
I have not heard of a built in feature that will do that for you.
You probably have to create something from scratch yourself.
Apr 07, 2010 10:06 AM|mvark|LINK
Adapt the snippet at this link to get the last modified date -
Apr 07, 2010 09:15 PM|Gary Frank|LINK
This seems to bear out what you said. It gets the last modified DateTime for static web sites but not for dynamic web sites. I am using this function in a desktop VB.NET program.
Function GetDateTimeLastModified(ByVal requestUriString As String) As DateTime
Dim DateTime_LastModified As DateTime = DateTime.Now
Dim request As HttpWebRequest
Dim response As HttpWebResponse
request = CType(WebRequest.Create(requestUriString), HttpWebRequest)
' We don't actually need to download the file to get information about it.
request.Method = "HEAD"
response = CType(request.GetResponse(), HttpWebResponse)
DateTime_LastModified = response.LastModified