[VB.Net] Webrequest help |
|
06-25-2012, 01:05 AM
|
|||
|
|||
|
Webrequest help
I trying to login a site from my vb app and it keeps saying login failed
Dim postData As String = "action=do_login&url=http%3A%2F%2FSITESIP%2F~soulvpsc%2Findex.php&quick_login=1&quick_username=" & TextBox1.Text & "&quick_password=" & TextBox2.Text & "&submit=Login&quick_remember=yes" Dim bytes() As Byte = ASCIIEncoding.UTF8.GetBytes(postData) Dim postReq As HttpWebRequest = WebRequest.Create("http://Sitesip/~soulvpsc/index.php") postReq.Method = "POST" postReq.KeepAlive = True postReq.CookieContainer = mainCookie postReq.ContentType = "application/x-www-form-urlencoded" postReq.Referer = "http://SITEIP/~soulvpsc/index.php" postReq.UserAgent = "Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.2.13) Gecko/20101203 Firefox/3.6.13 ( .NET CLR 3.5.30729; .NET4.0E)" postReq.ContentLength = bytes.Length Dim postStream As Stream = postReq.GetRequestStream() postStream.Write(bytes, 0, bytes.Length) postStream.Close() Dim postResponse As HttpWebResponse postResponse = postReq.GetResponse() mainCookie.Add(postResponse.Cookies) Dim reader As New StreamReader(postResponse.GetResponseStream()) Dim strSource As String = reader.ReadToEnd If strSource.Contains("Welcome," & TextBox1.Text & "!") Then MessageBox.Show("Login Successful") Else MessageBox.Show("Login Failed") End If |
|||
|
06-25-2012, 09:04 AM
(This post was last modified: 06-25-2012 09:05 AM by KoBE.)
|
|||
|
|||
|
RE: Webrequest help
This looks as though you're trying to login to a MyBB forum correct?
You might read through the source and make sure that it's not asking you for a captcha. After a few failed attempts, it will ask for a captcha to prevent automated attempts such as this. In that case, it would not appear to be working. |
|||
|
06-25-2012, 10:12 PM
|
|||
|
|||
RE: Webrequest help
(06-25-2012 09:04 AM)KoBE Wrote: This looks as though you're trying to login to a MyBB forum correct?pmed you for some help |
|||
|
06-25-2012, 10:35 PM
|
|||
|
|||
RE: Webrequest help
(06-25-2012 10:12 PM)unknown18 Wrote:lol why not just make use of this thread which is already open so that more than one person can help?(06-25-2012 09:04 AM)KoBE Wrote: This looks as though you're trying to login to a MyBB forum correct?pmed you for some help
![]() Microsoft MVP .NET Programming - (2012 - Present) ®Crestron DMC-T Certified Automation Programmer Development Site: aceinfinity.net |
|||
|
06-25-2012, 10:54 PM
|
|||
|
|||
RE: Webrequest help
(06-25-2012 10:35 PM)AceInfinity Wrote:because i dont want to post the link i trying to login to on here for every 1 to try an access(06-25-2012 10:12 PM)unknown18 Wrote:lol why not just make use of this thread which is already open so that more than one person can help?(06-25-2012 09:04 AM)KoBE Wrote: This looks as though you're trying to login to a MyBB forum correct?pmed you for some help |
|||
|
06-25-2012, 10:57 PM
|
|||
|
|||
|
RE: Webrequest help
You don't have to post credentials at all... Just fake the data and let them know that you're not giving it out for confidentiality reasons. Simple, i'd never give anybody a login of mine if that's what the link contained for POST data or anything like that.
![]() Microsoft MVP .NET Programming - (2012 - Present) ®Crestron DMC-T Certified Automation Programmer Development Site: aceinfinity.net |
|||
|
06-25-2012, 11:37 PM
|
|||
|
|||
|
RE: Webrequest help
well it not a my bb site so idk how i would post it
|
|||
|
06-26-2012, 12:22 AM
|
|||
|
|||
|
RE: Webrequest help
I didn't even really see the code you initially posted to be honest. You didn't use code tags... I'll see what KoBE responds to you first before making an attempt here.
![]() Microsoft MVP .NET Programming - (2012 - Present) ®Crestron DMC-T Certified Automation Programmer Development Site: aceinfinity.net |
|||
|
06-26-2012, 09:56 AM
|
|||
|
|||
|
RE: Webrequest help
Ok, I've looked at the site. I'm almost certain you are not sending the correct post data.
I can't test this out at work, but go through the steps of capturing the headers as layed out in this thread: http://tech.reboot.pro/showthread.php?tid=61 After that you will probably notice you need to modify this line: Code: (SELECT ALL CODE) Dim postData As String = "action=do_login&url=http%3A%2F%2FSITESIP%2F~soulvpsc%2Findex.php&quick_login=1&quick_username=" & TextBox1.Text & "&quick_password=" & TextBox2.Text & "&submit=Login&quick_remember=yes" |
|||
|
06-26-2012, 11:42 PM
|
|||
|
|||
|
RE: Webrequest help
Ok, well I had a look now that I'm on my laptop w/ Live HTTP Headers.
All the post data you should be sending is: Code: (SELECT ALL CODE) username=user&password=pass |
|||
Possibly Related Threads... |
| Thread: | Author | Replies: | Views: | Last Post | |
How would i do this useing webrequest |
unknown18 | 16 | 938 |
08-24-2012 01:20 AM Last Post: unknown18 |
|
Help Basic Webrequest |
ReDDeMiSe | 8 | 554 |
12-30-2011 06:52 PM Last Post: AceInfinity |
|
| [Vb.net]MegaUpload Login Using webrequest [Source Code][Vb.net] | ekrozzz | 2 | 1,237 |
12-23-2011 02:31 AM Last Post: AceInfinity |
|
| Users browsing this thread |
| 1 Guest(s) |

Webrequest help


