Using HTTPWebRequest in ASP.NET VB

I don't know how to use this class in .net. Anyone would like to share their knowledge on how to implement and use this class?

Do you have a simple procedure that calls the page and processes it?

0


a source to share


2 answers


Dim request = HttpWebRequest.Create("http://www.google.com")
Dim response = request.GetResponse()
Using reader = New StreamReader(response.GetResponseStream())
    Console.WriteLine(reader.ReadToEnd())
End Using

      



+4


a source


The easiest way is to use a class WebClient

that simplifies most of the common uses of HttpWebRequest.

Example in C #:



string page;
using (WebClient client = new WebClient()) {
   page = client.DownloadString("http://www.guffa.com");
}

      

+4


a source







All Articles