Results 1 to 3 of 3

Thread: HTTPrequest, cookie trouble

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Jul 2009
    Posts
    629

    Unhappy HTTPrequest, cookie trouble

    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:

    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
    But I get this error on the site:
    "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

  2. #2

    Thread Starter
    Fanatic Member
    Join Date
    Jul 2009
    Posts
    629

    Re: HTTPrequest, cookie trouble

    Please answer me, I really need to know how to set cookies for further purposes =(

  3. #3

    Thread Starter
    Fanatic Member
    Join Date
    Jul 2009
    Posts
    629

    Re: HTTPrequest, cookie trouble

    Bump:

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width