我试图从我的 ftp 中的某些文件中获取日期和时间,但它总是返回 1/1/0001 12:00:00 AM .. 为什么?
一切似乎都很好,我做错了什么?
for (int i = 0; i < lsnames.Count; i++)
{
ftpclient = (FtpWebRequest)WebRequest.Create(FTPPATH + lsnames[i].ToString());
ftpclient.Credentials = new NetworkCredential("username", "password");
ftpclient.UsePassive = true;
ftpclient.UseBinary = true;
ftpclient.KeepAlive = false;
ftpclient.Method = WebRequestMethods.Ftp.ListDirectoryDetails;
FtpWebResponse TimestampResponse = (FtpWebResponse)ftpclient.GetResponse();
try { label2.Text = TimestampResponse.LastModified.ToString(); }
catch { Label2Invocation(TimestampResponse.LastModified.ToString()); }
Console.WriteLine("{0}", TimestampResponse.LastModified);
MessageBox.Show("Dates: " + Convert.ToString(TimestampResponse.LastModified));
TimestampResponse.Close();
}