WebRequest.RequestUri Property gets the URI of the Internet resource associated with the request.
Imports System.IO
Imports System.Net
Imports System.Text
public class MainClass
Shared Sub Main()
Dim myWebRequest As WebRequest = WebRequest.Create("http://www.domain.com")
Console.WriteLine(ControlChars.Cr + ControlChars.Lf +"The Uri that was requested is {0}", myWebRequest.RequestUri)
Dim myWebResponse As WebResponse = myWebRequest.GetResponse()
Dim streamResponse As Stream = myWebResponse.GetResponseStream()
Console.WriteLine("The Uri that responded to the request is {0}", myWebResponse.ResponseUri)
Dim reader As New StreamReader(streamResponse)
Dim responseFRomServer As String = reader.ReadToEnd()
Console.WriteLine (responseFromServer)
reader.Close ()
streamResponse.Close ()
myWebResponse.Close ()
End Sub
End Class
Related examples in the same category