Export (0) Print
Expand All

FtpWebResponse.LastModified Property

Gets the date and time that a file on an FTP server was last modified.

Namespace: System.Net
Assembly: System (in system.dll)

public:
property DateTime LastModified {
	DateTime get ();
}
/** @property */
public DateTime get_LastModified ()

public function get LastModified () : DateTime

Not applicable.

Property Value

A DateTime that contains the last modified date and time for a file.

The LastModified property returns the data requested by the GetDateTimeStamp method. For requests sent using any other method, LastModified returns MinValue.

The following code example displays the date and time that a file on an FTP server was last modified.

public static bool GetDateTimestampOnServer (Uri serverUri)
{
    // The serverUri should start with the ftp:// scheme.
    if (serverUri.Scheme != Uri.UriSchemeFtp)
    {
        return false;
    }

    // Get the object used to communicate with the server.
    FtpWebRequest request = (FtpWebRequest)WebRequest.Create (serverUri);
    request.Method = WebRequestMethods.Ftp.GetDateTimestamp;
    FtpWebResponse response = (FtpWebResponse)request.GetResponse ();
    Console.WriteLine ("{0} {1}",serverUri,response.LastModified);

    // The output from this method will vary depending on the 
    // file specified and your regional settings. It is similar to:
    // ftp://contoso.com/Data.txt 4/15/2003 10:46:02 AM
    return true;
}

Windows 98, Windows Server 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0, 2.0

Community Additions

ADD
Show:
© 2014 Microsoft