Problems Getting Html

CarcaBot

Well-known member
Joined
Apr 23, 2007
Messages
47
Location
Romania
Programming Experience
Beginner
hello ,

i have some problems when i read an url

I have a windows form where i declare login and password to log-in into a forum
all it's ok , i navigate to a section ( specified in windows form ) and when i get the html source, i see as i must log-in again...

The url is setted correctly, because on redirection is added to it.


i use following code for read url content:
VB.NET:
  Dim ms As String = ""
        Try
            Dim req As WebRequest = WebRequest.Create("http://" + what) ' what is the url eg.: forum.com/viewforum.php?f=1
            Dim result As WebResponse = req.GetResponse()
            Dim ReceiveStream As Stream = result.GetResponseStream()
            Dim enc As Encoding = System.Text.Encoding.GetEncoding("utf-8")
            Dim sr As StreamReader = New StreamReader(ReceiveStream, enc)
            ms = sr.ReadToEnd()

        Catch x As Exception
            MsgBox(x.StackTrace)
            MsgBox("Bad URL: " + "http://" + what, what)
        End Try
        RichTextBox2.Text = ms 
    End Sub

I think is not allowed to create a new web request ... :-/
anyone know ?
 
Back
Top