次の方法で共有


FileWebRequest.RequestUri プロパティ

要求の URI を取得します。

Overrides Public ReadOnly Property RequestUri As Uri
[C#]
public override Uri RequestUri {get;}
[C++]
public: __property Uri* get_RequestUri();
[JScript]
public override function get RequestUri() : Uri;

プロパティ値

要求の URI を格納する Uri

使用例

[Visual Basic, C#, C++] RequestUri プロパティを使用して、要求の URI を取得する例を次に示します。

 
' Compare the file name and 'RequestUri' is same or not.
If myFileWebRequest.RequestUri.Equals(myUrl) Then
    ''GetRequestStream' method returns the stream handler for writing into the file.
    Dim readStream As Stream = myFileWebRequest.GetRequestStream()
    ' Write to the stream.
    readStream.Write(byteArray, 0, userInput.Length)
            readStream.Close()
End If

Console.WriteLine("The String you entered was successfully written into the file.")
Console.WriteLine((ControlChars.Cr +"The content length sent to the server is " + myFileWebRequest.ContentLength.ToString() + "."))

[C#] 
// Compare the file name and 'RequestUri' is same or not.
if(myFileWebRequest.RequestUri.Equals(myUrl))
{
    // 'GetRequestStream' method returns the stream handler for writing into the file.
    Stream readStream =myFileWebRequest.GetRequestStream();
    // Write to the stream
    readStream.Write(byteArray,0,userInput.Length);
   readStream.Close();
}

Console.WriteLine("\nThe String you entered was successfully written into the file.");    
Console.WriteLine("The content length sent to the server is "+myFileWebRequest.ContentLength+".");    


[C++] 
// Compare the file name and 'RequestUri' is same or not.
if (myFileWebRequest->RequestUri->Equals(myUrl)) {
   // 'GetRequestStream' method returns the stream handler for writing into the file.
   Stream* readStream =myFileWebRequest->GetRequestStream();
   // Write to the stream
   readStream->Write(byteArray, 0, userInput->Length);
   readStream->Close();
}

Console::WriteLine(S"\nThe String you entered was successfully written into the file.");
Console::WriteLine(S"The content length sent to the server is {0}.", 
   __box( myFileWebRequest->ContentLength));

[JScript] JScript のサンプルはありません。Visual Basic、C#、および C++ のサンプルを表示するには、このページの左上隅にある言語のフィルタ ボタン 言語のフィルタ をクリックします。

必要条件

プラットフォーム: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 ファミリ

参照

FileWebRequest クラス | FileWebRequest メンバ | System.Net 名前空間