HttpWebResponse.LastModified プロパティ
アセンブリ: System (system.dll 内)

public DateTime LastModified { get; }
応答の内容が変更された日付と時刻を格納する DateTime。



この例では、HttpWebRequest を作成し、応答を問い合わせます。この例では、次に、要求したエンティティが今日の任意の時刻に変更されたかどうかを確認します。
Dim myUri As New Uri(url) ' Creates an HttpWebRequest for the specified URL. Dim myHttpWebRequest As HttpWebRequest = CType(WebRequest.Create(myUri), HttpWebRequest) Dim myHttpWebResponse As HttpWebResponse = CType(myHttpWebRequest.GetResponse(), HttpWebResponse) If myHttpWebResponse.StatusCode = HttpStatusCode.OK Then Console.WriteLine(ControlChars.Lf + ControlChars.Cr + "Request succeeded and the requested information is in the response , Description : {0}", myHttpWebResponse.StatusDescription) End If Dim today As DateTime = DateTime.Now ' Uses the LastModified property to compare with today's date. If DateTime.Compare(today, myHttpWebResponse.LastModified) = 0 Then Console.WriteLine(ControlChars.Cr + "The requested URI entity was modified today") Else If DateTime.Compare(today, myHttpWebResponse.LastModified) = 1 Then Console.WriteLine(ControlChars.Cr + "The requested Uri was last modified on:{0}", myHttpWebResponse.LastModified) End If End If ' Releases the resources of the response. myHttpWebResponse.Close()
Uri myUri = new Uri(url); // Creates an HttpWebRequest for the specified URL. HttpWebRequest myHttpWebRequest = (HttpWebRequest)WebRequest.Create(myUri); HttpWebResponse myHttpWebResponse = (HttpWebResponse)myHttpWebRequest.GetResponse(); if (myHttpWebResponse.StatusCode == HttpStatusCode.OK) Console.WriteLine("\r\nRequest succeeded and the requested information is in the response , Description : {0}", myHttpWebResponse.StatusDescription); DateTime today = DateTime.Now; // Uses the LastModified property to compare with today's date. if (DateTime.Compare(today,myHttpWebResponse.LastModified) == 0) Console.WriteLine("\nThe requested URI entity was modified today"); else if (DateTime.Compare(today,myHttpWebResponse.LastModified) == 1) Console.WriteLine("\nThe requested URI was last modified on:{0}" , myHttpWebResponse.LastModified); // Releases the resources of the response. myHttpWebResponse.Close();
Uri^ myUri = gcnew Uri( url ); // Creates an HttpWebRequest for the specified URL. HttpWebRequest^ myHttpWebRequest = (HttpWebRequest^)( WebRequest::Create( myUri ) ); HttpWebResponse^ myHttpWebResponse = (HttpWebResponse^)( myHttpWebRequest->GetResponse() ); if ( myHttpWebResponse->StatusCode == HttpStatusCode::OK ) { Console::WriteLine( "\r\nRequest succeeded and the requested information is in the response , Description : {0}", myHttpWebResponse->StatusDescription ); } DateTime today = DateTime::Now; // Uses the LastModified property to compare with today's date. if ( DateTime::Compare( today, myHttpWebResponse->LastModified ) == 0 ) { Console::WriteLine( "\nThe requested URI entity was modified today" ); } else if ( DateTime::Compare( today, myHttpWebResponse->LastModified ) == 1 ) { Console::WriteLine( "\nThe requested URI was last modified on: {0}" , myHttpWebResponse->LastModified ); } // Releases the resources of the response. myHttpWebResponse->Close();
Uri myUri = new Uri(url); // Creates an HttpWebRequest for the specified URL. HttpWebRequest myHttpWebRequest = (HttpWebRequest) WebRequest.Create(myUri); HttpWebResponse myHttpWebResponse = (HttpWebResponse) myHttpWebRequest.GetResponse(); if (myHttpWebResponse.get_StatusCode().Equals(HttpStatusCode.OK)) { Console.WriteLine("\r\nRequest succeeded and the requested " + "information is in the response , Description : {0}", myHttpWebResponse.get_StatusDescription()); } DateTime today = DateTime.get_Now(); // Uses the LastModified property to compare with today's date. if (DateTime.Compare(today, myHttpWebResponse.get_LastModified()) == 0) { Console.WriteLine("\nThe requested URI entity was modified " + "today"); } else { if (DateTime.Compare(today, myHttpWebResponse.get_LastModified()) == 1) { Console.WriteLine("\nThe requested URI was last " + "modified on:{0}", myHttpWebResponse.get_LastModified()); } } // Releases the resources of the response. myHttpWebResponse.Close();

Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


Weblioに収録されているすべての辞書からHttpWebResponse.LastModified プロパティを検索する場合は、下記のリンクをクリックしてください。

- HttpWebResponse.LastModified プロパティのページへのリンク