Public Sub Lookup() Dim WebAddress As String = "http://www.yahoo.com" ' Create a request for the URL. Dim request As WebRequest = _ WebRequest.Create(WebAddress) ' If required by the server, set the credentials. request.Credentials = CredentialCache.DefaultCredentials ' Get the response. Dim response As WebResponse = request.GetResponse() ' Display the status. Console.WriteLine(CType(response, HttpWebResponse).StatusDescription) ' Get the stream containing content returned by the server. Dim dataStream As Stream = response.GetResponseStream() ' Open the stream using a StreamReader for easy access. Dim reader As New StreamReader(dataStream) ' Read the content. Dim responseFromServer As String = reader.ReadToEnd() ' Display the content. Label2.Text = WebAddress Label3.Text = responseFromServer ' Clean up the streams and the response. reader.Close() response.Close() End Sub
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)