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

VS 2010 HttpWebRequest help

$
0
0
here is my code to log into my bank sorry no passwords no usernames given im not a dumb lol




Code:

Sub post()
        Dim EVENTVALIDATION = "/wEWAgKtxsLgBgLq+LO5Ad+NdnQm+T4IWqelkoLu3kPVgHtm"
        Dim urlLocator = "https://www.regions.com/Locations.rf"
        Dim locationZipCode = "ZIP+Code"
        Dim locationCity = "City"
        Dim locationState = "State"
        Dim googleSearch = ""
        Dim OnlineID = "removed"
        Dim Password = "removed"

        Dim mainCookie As New System.Net.CookieContainer
        Dim post = "ignore=" & "&__EVENTVALIDATION=" & EVENTVALIDATION & "&ctl00%24hfurlLocator=" & urlLocator & "&locationZipCode=" & locationZipCode & "&locationCity=" & locationCity & "&locationState=" & locationState & "&googleSearch=" & googleSearch & "&OnlineID=" & OnlineID & "&Password=" & Password

        'login
        Dim postData As String = post
        Dim bytes() As Byte = System.Text.ASCIIEncoding.UTF8.GetBytes(postData)
        Dim postReq As System.Net.HttpWebRequest = System.Net.WebRequest.Create("https://securebank.regions.com/login.aspx?brand=regions")
        postReq.Method = "POST"
        postReq.Host = "securebank.regions.com"
        postReq.UserAgent = "Mozilla/5.0 (Windows NT 6.1; rv:17.0) Gecko/20100101 Firefox/17.0"
        postReq.Accept = "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"
        postReq.ContentType = "application/x-www-form-urlencoded"
        postReq.KeepAlive = True
        postReq.Referer = "https://www.regions.com/personal_banking.rf"
        postReq.CookieContainer = mainCookie
        postReq.ContentType = "application/x-www-form-urlencoded"
        postReq.ContentLength = bytes.Length

        Dim postStream As System.IO.Stream = postReq.GetRequestStream()
        postStream.Write(bytes, 0, bytes.Length)
        postStream.Close()

        Dim postResponse As System.Net.HttpWebResponse
        postResponse = postReq.GetResponse()
        mainCookie.Add(postResponse.Cookies)
        Dim reader As New System.IO.StreamReader(postResponse.GetResponseStream())
        Dim strSource As String = reader.ReadToEnd
        RichTextBox1.Text = strSource

    End Sub

when i run it it takes about a minute to show the main form and displays nothing on the richtext document does anyone have a idea what may be wrong? i got the post data from live http headers firefox addon im trying to get the source of the webpage after it logs in
to add to that when i take away the post data it shows the https://securebank.regions.com/login.aspx (not loged in )


it seems to be getting stuck at postResponse = postReq.GetResponse()
i finally got this error The underlying connection was closed: An unexpected error occurred on a receive.


here is the values with omitted information as "removed" im really lost on getting this to work

post https://securebank.regions.com/login.aspx?brand=regions

http header

Host: securebank.regions.com
User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:17.0) Gecko/20100101 Firefox/17.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
DNT: 1
Connection: keep-alive
Referer: https://www.regions.com/
Cookie: WT_FPC=id=removed:lv=removed:ss=removed
Content-Type: application/x-www-form-urlencoded
Content-Length: 266

post data

ignore=&__EVENTVALIDATION=%2FwEWAgKtxsLgBgLq%2BLO5Ad%2BNdnQm%2BT4IWqelkoLu3kPVgHtm&ctl00%24hfurlLoca tor=https%3A%2F%2Fwww.regions.com%2FLocations.rf&locationZipCode=ZIP+Code&locationCity=City&location State=State&googleSearch=&OnlineID=removed&Password=removed

Viewing all articles
Browse latest Browse all 27201

Trending Articles



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