Last Modified FTP VB.NET File
How do you get date modified from file on FTP server in visual basic?
This is what I have so far:
Dim request = CType(WebRequest.Create(URL + ZipFile), FtpWebRequest)
request.Method = WebRequestMethods.Ftp.GetDateTimestamp
I tried a couple of lines after that, but no one returned the date.
+3
source to share
1 answer
Well, I got it, but I'll leave it here as I couldn't find any other vb.net posts about this:
Imports System.Net
Imports System.Globalization
Dim request = CType(WebRequest.Create(URL + ZipFile), FtpWebRequest)
request.Method = WebRequestMethods.Ftp.GetDateTimestamp
Dim response = CType(request.GetResponse(), FtpWebResponse)
Dim ServerDate = DateTime.ParseExact(response.StatusDescription.Substring(4,14),"yyyyMMddHHmmss",_
Cultureinfo.InvariantCulture,DateTimeStyles.None)
+2
source to share