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

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

WebClient.BaseAddress プロパティ

WebClient で作成され要求ベース URI取得または設定します

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

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

インターネット サーバーからデータダウンロードし、コンソール表示するコード例次に示しますサーバーアドレス (http://www.contoso.com など) が hostUri にあり、リソースへのパス (/default.htm など) が uriSuffix にあることを前提にしています。

    ' Create a new WebClient instance.
    Dim myWebClient As New
 WebClient()

    ' Set the BaseAddress of the Web resource in the WebClient.
    myWebClient.BaseAddress = hostUri
    Console.WriteLine(("Downloading from " + hostUri
 + "/" + uriSuffix))
    Console.WriteLine(ControlChars.Cr + "Press Enter key to continue")
    Console.ReadLine()

    ' Download the target Web resource into a byte array.
    Dim myDatabuffer As Byte()
 = myWebClient.DownloadData(uriSuffix)

    ' Display the downloaded data.
Dim download As String =
 Encoding.ASCII.GetString(myDatabuffer)
Console.WriteLine(download)

    Console.WriteLine(("Download of " + myWebClient.BaseAddress.ToString()
 + uriSuffix + " was successful."))
// Create a new WebClient instance.
WebClient myWebClient = new WebClient();

// Set the BaseAddress of the Web Resource in the WebClient.
myWebClient.BaseAddress = hostUri;
Console.WriteLine("Downloading from " + hostUri + "/" + uriSuffix);
Console.WriteLine("\nPress Enter key to continue");
Console.ReadLine();    

// Download the target Web Resource into a byte array.
byte[] myDatabuffer = myWebClient.DownloadData (uriSuffix);

// Display the downloaded data.
string download = Encoding.ASCII.GetString(myDatabuffer);
Console.WriteLine(download);

Console.WriteLine("Download of " + myWebClient.BaseAddress.ToString() +
 uriSuffix + " was successful.");
// Create a new WebClient instance.
WebClient^ myWebClient = gcnew WebClient;

// Set the BaseAddress of the Web Resource in the WebClient.
myWebClient->BaseAddress = hostUri;
Console::WriteLine( "Downloading from {0}/ {1}", hostUri, uriSuffix );
Console::WriteLine( "\nPress Enter key to continue" );
Console::ReadLine();

// Download the target Web Resource into a Byte array.
array<Byte>^ myDatabuffer = myWebClient->DownloadData( uriSuffix );

// Display the downloaded data.
String^ download = Encoding::ASCII->GetString( myDatabuffer );
Console::WriteLine( download );
Console::WriteLine( "Download of {0}{1} was successful.", myWebClient->BaseAddress,
 uriSuffix );
// Create a new WebClient instance.
WebClient myWebClient = new WebClient();
// Set the BaseAddress of the Web Resource in the WebClient.
myWebClient.set_BaseAddress(hostUri);
Console.WriteLine("Downloading from " + hostUri + "/" + uriSuffix);
Console.WriteLine("\nPress Enter key to continue");
Console.ReadLine();
// Download the target Web Resource into a byte array.
ubyte myDatabuffer[] = myWebClient.DownloadData(uriSuffix);
// Display the downloaded data.
String download = Encoding.get_ASCII().GetString(myDatabuffer);
Console.WriteLine(download);

Console.WriteLine("Download of " + myWebClient.get_BaseAddress().
    ToString() + uriSuffix + " was successful.");
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照



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

辞書ショートカット

すべての辞書の索引

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

   

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



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

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

©2024 GRAS Group, Inc.RSS