Hello guys, ive tryed alot of HTTP codes to try login to EA Forums, But some reason i cant do it. It does re-direct on login and im wondering if this has anything to do with it.
Any help would be much appreciated.
Imports System.Net
Imports System.Text
Imports System.IO
Public Class Form1
Dim logincookie As CookieContainer
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim cookieJar As New Net.CookieContainer()
Dim request As Net.HttpWebRequest
Dim response As Net.HttpWebResponse
Dim strURL As String
Try
'Get Cookies
strURL = "https://profile.ea.com/login.do?authenticationSource=EA-JForums&surl=http://forum.ea.com/uk/pm/sendTo/500516.page&remoteurl=http://forum.ea.com/uk/gusUser/login.page&selectprofile=true&locale=en_GB"
request = Net.HttpWebRequest.Create(strURL)
request.UserAgent = "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.3) Gecko/20100401 Firefox/3.6.3"
request.Method = "GET"
request.CookieContainer = cookieJar
response = request.GetResponse()
For Each tempCookie As Net.Cookie In response.Cookies
cookieJar.Add(tempCookie)
Next
'Send the post data now
request = Net.HttpWebRequest.Create(strURL)
request.UserAgent = "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.3) Gecko/20100401 Firefox/3.6.3"
request.Method = "POST"
request.AllowAutoRedirect = True
request.CookieContainer = cookieJar
Dim writer As StreamWriter = New StreamWriter(request.GetRequestStream())
writer.Write("surl=http%3A%2F%2Fforum.ea.com%2Fuk%2Fpm%2FsendTo%2F500516.page&selectprofile=true&remoteurl=http%3A%2F%2Fforum.ea.com%2Fuk%2FgusUser%2Flogin.page&action=Login®istrationSource=&authenticationSource=EA-JForums&HIDE_GUS=&username=" & TextBox1.Text & "&password=" & TextBox2.Text & "")
writer.Close()
response = request.GetResponse()
'Get the data from the page
Dim stream As StreamReader = New StreamReader(response.GetResponseStream())
Dim data As String = stream.ReadToEnd()
response.Close()
If data.Contains("<title>EA Forums") = True Then
MessageBox.Show("Logged In")
RichTextBox1.Text = data
Else
MessageBox.Show("Not Logged In")
RichTextBox1.Text = data
End If
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Sub
End Class