How do i get Web page Source?

  • Thread starter Thread starter kdh7807
  • Start date Start date
I've Used inet Control at vb 6.0
But in .NET, I Can't fint that.
Anyone can help me?

Take a look at the System.Net namespace and associated classes. I'm not
sure about the new stuff in .Net 2.0+, but I do believe it has some new
stuff not available in 1.1. Since our shop is still in the stone age...err,
..Net 1.1 age, we have just had to manage using the normal HttpRequest and
HttpResponse.

Mythran
 
kdh7 said:
I've Used inet Control at vb 6.0
But in .NET, I Can't fint that.

Not sure if this is really the alternative to the inet control, but
maybe you should take a look at the System.Net.Socket.TcpClient class
and its friends.

Regards,

Branco.
 
Here is some code from one of my routines that takes the URL in a text box
(e.g. http://www.IMB.com) and returns the underlying HTML for the URL as the
string S below.

Dim URL As String = Trim(Me.txtURL.Text)
Dim wreq As System.Net.HttpWebRequest
wreq = CType(System.Net.WebRequest.Create(URL),
System.Net.HttpWebRequest)
Dim response As System.Net.HttpWebResponse = wreq.GetResponse
Dim encode As System.Text.Encoding =
System.Text.Encoding.GetEncoding("utf-8")
Dim readStream As New
System.IO.StreamReader(response.GetResponseStream, encode)
Dim S As String = readStream.ReadToEnd
readStream.Close()
readStream = Nothing
response.Close()
response = Nothing
Me.txtPage.Text = S
wreq = Nothing
 
Back
Top