I use visual basic .net express edition 2008
I figured out how to do httprequests and how to login using them.
I tried to login onto http://www.lostpirates.co.uk this is the code:
But I get this error on the site:Code:Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim postdata As String = "username=name & user_password=pass & op=login" '(Dim postdata As String = TextBox1.Text) Try Dim uri As New Uri("http://www.lostpirates.co.uk/modules.php?name=Your_Account") Dim text As String = "" 'this part is for my own purposes 'I used a textbox to try different postdata. 'vbcrlf had to be added sometimes. For Each item As String In postdata.Split If item.ToLower = "vbcrlf" Then text &= vbCrLf Else text &= item End If Next 'end of filtering vbcrlf, data is there. Dim data As String = text MsgBox(data) Dim request As HttpWebRequest = HttpWebRequest.Create(uri) request.UserAgent = "Mozilla/5.0 (Windows; U; Windows NT 6.0; nl; rv:1.9.1.3) Gecko/20090824 Firefox/3.5.3 (.NET CLR 3.5.30729)" request.KeepAlive = 30 request.Method = WebRequestMethods.Http.Post request.ContentLength = data.Length request.ContentType = "application/x-www-form-urlencoded" request.Method = "POST" request.AllowAutoRedirect = False Dim writer As New StreamWriter(request.GetRequestStream()) writer.Write(data) writer.Close() Dim response As HttpWebResponse = request.GetResponse() Dim reader As New StreamReader(response.GetResponseStream()) Dim tmp As String = reader.ReadToEnd() response.Close() WebBrowser1.DocumentText = tmp MsgBox("Done request") Catch ex As Exception If ex.Message <> "" Then MsgBox("Error:" & vbCrLf & vbCrLf & ex.Message, MsgBoxStyle.Critical) End Try End Sub
"Cookie functions seem to be disabled. Please change your browser settings!"
How can I set a cookie container so I can login onto the site?
I tried a lot of things, such as cookiecontainer.
I tried googlin' it, but no helpfull info found
Please help![]()





Reply With Quote