FtpWebResponse.LastModified Property

Note: This property is new in the .NET Framework version 2.0.

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

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

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

public function get LastModified () : DateTime

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 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 .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.

.NET Framework

Supported in: 2.0

Community Additions