I need to know why this isn't working... I have tried many different things but still can't get it to work. (And, yes, I have replaced the MYPASSHERE with my password but it always says I have not registered yet...)

Imports System.Net
Imports System.IO
Imports System.Text
Public Class Form1

    Dim logincookies As CookieContainer

    Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        Dim PostData As String = "action=do_login&url=http%3A%2F%2Fhighqualityforums.com%2F&quick_login=1&quick_username=yorkiebar15&quick_password=MYPASSHERE&submit=Login&quick_remember=yes"
        Dim TempCookies As New CookieContainer 'Temp Cookies
        Dim Encoding As New UTF8Encoding 'Declaring it
        Dim ByteData As Byte() = Encoding.GetBytes(PostData) 'Converting since it can't read VB.Net strings

        Dim postReq As HttpWebRequest = DirectCast(WebRequest.Create("http://highqualityforums.com/member.php"), HttpWebRequest)
        postReq.Method = "POST" 'The method is to "POST" the Login Data
        postReq.KeepAlive = True 'No timeouts
        postReq.CookieContainer = tempCookies 'Use Temp Cookies, you'll see why later.
        postReq.ContentType = "application/x-www-form-urlencoded" 'It's an HTML Form
        postReq.Referer = "http://highqualityforums.com/"
        postReq.UserAgent = "Mozilla/5.0 (Windows; U; Windows NT 6.1; ru; rv: Gecko/20100401 Firefox/4.0 (.NET CLR 3.5.30729)"
        postReq.ContentLength = ByteData.Length 'Counts ByteData Length

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

        postresponse = DirectCast(postReq.GetResponse(), HttpWebResponse)
        TempCookies.Add(postresponse.Cookies) 'We want those cookies
        logincookies = TempCookies ' Will let us browse with it later
        Dim postreqreader As New StreamReader(postresponse.GetResponseStream())

        Dim ThePage As String = postreqreader.ReadToEnd 'We now have a string with the page.

        WebBrowser1.DocumentText = ThePage
    End Sub
End Class

Wow, nvm, I've fixed it :L

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.