Quantcast
Channel: VBForums
Viewing all articles
Browse latest Browse all 42215

VS 2010 Finding LastModifiedDate of file using URL

$
0
0
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:

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

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.

Viewing all articles
Browse latest Browse all 42215

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>