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



派生クラスでオーバーライドされると、RequestUri プロパティは、Create メソッドが要求を作成するために使用する Uri インスタンスを格納します。
![]() |
---|
WebRequest クラスは、abstract クラスです。実行時の WebRequest インスタンスの実際の動作は、System.Net.WebRequest.Create メソッドで返される派生クラスによって決まります。既定値および例外の詳細については、HttpWebRequest や FileWebRequest などの派生クラスの説明を参照してください。 |

RequestUri プロパティを確認して、最初に要求されたサイトかどうかを確かめる例を次に示します。
' Create a new WebRequest Object to the mentioned URL. Dim myWebRequest As WebRequest = WebRequest.Create("http://www.example.com") Console.WriteLine(ControlChars.Cr + "The Uri that responded for the Request is {0}", myWebRequest.RequestUri) ' Assign the response object of 'WebRequest' to a 'WebResponse' variable. Dim myWebResponse As WebResponse = myWebRequest.GetResponse() ' Print the HTML contents of the page to the console. Dim streamResponse As Stream = myWebResponse.GetResponseStream() Dim streamRead As New StreamReader(streamResponse) Dim readBuff(256) As [Char] Dim count As Integer = streamRead.Read(readBuff, 0, 256) Console.WriteLine(ControlChars.Cr + "The Uri that responded for the Request is {0}", myWebRequest.RequestUri)
// Create a new WebRequest Object to the mentioned URL. WebRequest myWebRequest=WebRequest.Create("http://www.example.com"); Console.WriteLine("\nThe Uri that responded for the Request is {0}",myWebRequest.RequestUri); // Assign the response object of 'WebRequest' to a 'WebResponse' variable. WebResponse myWebResponse=myWebRequest.GetResponse(); // Print the HTML contents of the page to the console. Stream streamResponse=myWebResponse.GetResponseStream(); StreamReader streamRead = new StreamReader( streamResponse ); Char[] readBuff = new Char[256]; int count = streamRead.Read( readBuff, 0, 256 ); Console.WriteLine("\nThe Uri that responded for the Request is '{0}'",myWebRequest.RequestUri);
// Create a new WebRequest object to the mentioned URL. WebRequest^ myWebRequest = WebRequest::Create( "http://www.example.com" ); Console::WriteLine( "\nThe Uri that responded for the Request is {0}", myWebRequest->RequestUri ); // Assign the response object of 'WebRequest' to a 'WebResponse' variable. WebResponse^ myWebResponse = myWebRequest->GetResponse(); // Print the HTML contents of the page to the console. Stream^ streamResponse = myWebResponse->GetResponseStream(); StreamReader^ streamRead = gcnew StreamReader( streamResponse ); array<Char>^ readBuff = gcnew array<Char>(256); int count = streamRead->Read( readBuff, 0, 256 ); Console::WriteLine( "\nThe Uri that responded for the Request is ' {0}'", myWebRequest->RequestUri );
// Create a new WebRequest Object to the mentioned URL. WebRequest myWebRequest = WebRequest.Create("http://www.example.com"); Console.WriteLine("\nThe Uri that responded for the Request is {0}", myWebRequest.get_RequestUri()); // Assign the response object of 'WebRequest' to a 'WebResponse' // variable. WebResponse myWebResponse = myWebRequest.GetResponse(); // Print the HTML contents of the page to the console. Stream streamResponse = myWebResponse.GetResponseStream(); StreamReader streamRead = new StreamReader(streamResponse); char readBuff[] = new char[256]; int count = streamRead.Read(readBuff, 0, 256); Console.WriteLine("\nThe Uri that responded for the Request" + " is '{0}'", myWebRequest.get_RequestUri());

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に収録されているすべての辞書からWebRequest.RequestUri プロパティを検索する場合は、下記のリンクをクリックしてください。

- WebRequest.RequestUri プロパティのページへのリンク