There's a website that maintains links to PDF files, and I want to check to see if the file has changed since the last time I downloaded it. I've got everything working except retrieving the LastModifiedDate of the file. The code I am using is as follows:
I am using VS 2010 on Windows 7, and have verified that the url I pass in does exist and is a valid link to a PDF file. What happens when I run this code is that the current date/time is returned, instead of the last modified date of the PDF file. Does anybody have any suggestions on how I can get the LastModifiedDate of a PDF on the net? Thanks in advance.
Code:
Try
Dim req As HttpWebRequest = (WebRequest.Create(url))
Dim resp As HttpWebResponse = (req.GetResponse())
Dim dt As String = resp.LastModified.ToString()
lblLnk1Mthd2.Text = dt
Catch ex As Exception
lblLnk1Mthd2.Text = "Error"
End Try