Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27514

POST Data website login not working

$
0
0
Hello, i have constructed a POST request to log into the website www.buyincoins.com

Here is my code;

Code:

Private Sub Button6_Click(sender As Object, e As EventArgs) Handles Button6.Click
        Dim postData As String = "LoginForm%5Busername%5D=MY USERNAME HERE&LoginForm%5Bpassword%5D=MY PASSWORD HERE&yt0=Sign+In"
        Dim tempCookies As New CookieContainer
        Dim encoding As New UTF8Encoding
        Dim byteData As Byte() = encoding.GetBytes(postData)

        Dim postReq As HttpWebRequest = DirectCast(WebRequest.Create("http://bicpay.buyincoins.com/site/login?siteId=660001&custom=http%3A%2F%2Fwww.buyincoins.com%2F"), HttpWebRequest)
        postReq.Method = "POST"
        postReq.KeepAlive = True
        postReq.CookieContainer = tempCookies
        postReq.ContentType = "application/x-www-form-urlencoded"
        postReq.Referer = "http://bicpay.buyincoins.com/site/login?siteId=660001&custom=http%3A%2F%2Fwww.buyincoins.com%2F"
        postReq.UserAgent = "Mozilla/5.0 (Windows; U; Windows NT 6.1; ru; rv:1.9.2.3) Gecko/20100401 Firefox/4.0 (.NET CLR 3.5.30729)"
        postReq.ContentLength = byteData.Length

        Dim postreqstream As Stream = postReq.GetRequestStream()
        postreqstream.Write(byteData, 0, byteData.Length)
        postreqstream.Close()
        Dim postresponse As HttpWebResponse

        postresponse = DirectCast(postReq.GetResponse(), HttpWebResponse)
        tempCookies.Add(postresponse.Cookies)
        logincookie = tempCookies
        Dim postreqreader As New StreamReader(postresponse.GetResponseStream())

        Dim thepage As String = postreqreader.ReadToEnd

        RichTextBox1.Text = thepage
    End Sub
 Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
        WebBrowser1.DocumentText = RichTextBox1.Text
    End Sub

The problem is the website doesnt log in.. It displays the home page but in just text form, the layout is completely wrong.
I have got the post data from a firefox extension called LiveHTTPHeaders, which is all correct according to the information on the internet.
I have tried several different versions of the code above but with no success.
Is anyone able to help me here?

Thanks

p.s here is the LiveHTTPHeader information if it helps.

http://bicpay.buyincoins.com/site/lo...incoins.com%2F

POST /site/login?siteId=660001&custom=http%3A%2F%2Fwww.buyincoins.com%2F HTTP/1.1
Host: bicpay.buyincoins.com
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:23.0) Gecko/20100101 Firefox/23.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate
Referer: http://bicpay.buyincoins.com/site/lo...incoins.com%2F
Cookie: __utma=222349704.1080259354.1379006229.1379006229.1379009124.2; __utmz=222349704.1379009124.2.2.utmcsr=bicpay.buyincoins.com|utmccn=(referral)|utmcmd=referral|utmcc t=/site/login; PHPSESSID=jg8s035attddsp6rksao776890; __utmb=222349704.7.10.1379009124; __utmc=222349704; username=MYUSERNAME IS HERE; siteId=660001; language=en
Connection: keep-alive
Content-Type: application/x-www-form-urlencoded
Content-Length: 96

LoginForm%5Busername%5D=MYUSERNAME IS HERE&LoginForm%5Bpassword%5D=HIDDENMYPASS&yt0=Sign+In
HTTP/1.1 302 Moved Temporarily

Please help, ive been struggling with this for hours!

Viewing all articles
Browse latest Browse all 27514

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>