Export (0) Print
Expand All
This topic has not yet been rated - Rate this topic

FileWebRequest.RequestUri Property

Gets the URI of the request.

[Visual Basic]
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;

Property Value

A Uri containing the URI of the request.

Example

[Visual Basic, C#, C++] The following example uses the RequestUri property to get the uri of the request.

[Visual Basic] 
' 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] No example is available for JScript. To view a Visual Basic, C#, or C++ example, click the Language Filter button Language Filter in the upper-left corner of the page.

Requirements

Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family

See Also

FileWebRequest Class | FileWebRequest Members | System.Net Namespace

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft. All rights reserved.