HttpWebResponse.LastModified プロパティとは? わかりやすく解説

Weblio 辞書 > コンピュータ > .NET Framework クラス ライブラリ リファレンス > HttpWebResponse.LastModified プロパティの意味・解説 

HttpWebResponse.LastModified プロパティ

応答内容最後に変更され日付と時刻取得します

名前空間: System.Net
アセンブリ: System (system.dll 内)
構文構文

例外例外
解説解説
使用例使用例

この例では、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();
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照


このページでは「.NET Framework クラス ライブラリ リファレンス」からHttpWebResponse.LastModified プロパティを検索した結果を表示しています。
Weblioに収録されているすべての辞書からHttpWebResponse.LastModified プロパティを検索する場合は、下記のリンクをクリックしてください。
 全ての辞書からHttpWebResponse.LastModified プロパティ を検索

英和和英テキスト翻訳>> Weblio翻訳
英語⇒日本語日本語⇒英語
  

辞書ショートカット

すべての辞書の索引

HttpWebResponse.LastModified プロパティのお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



HttpWebResponse.LastModified プロパティのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

   
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2024 Microsoft.All rights reserved.

©2024 GRAS Group, Inc.RSS