login to my hotmail account http post Help

Discussion in 'Programming General' started by ipivb, Sep 17, 2009.

login to my hotmail account http post Help
  1. Unread #1 - Sep 17, 2009 at 2:16 AM
  2. ipivb
    Joined:
    Sep 17, 2009
    Posts:
    9
    Referrals:
    0
    Sythe Gold:
    0

    ipivb Newcomer

    login to my hotmail account http post Help

    hello i can't figure out how to set cookies im trying to login to my hotmail account using send postdata here is the code im using
    Code:
     Imports System
    Imports System.Collections.Generic
    Imports System.ComponentModel
    Imports System.Data
    Imports System.Drawing
    Imports System.Linq
    Imports System.Text
    Imports System.Windows.Forms
    Imports System.Net
    Imports System.IO
    Public Class Form1
        Inherits Form
        Public Sub New()
            InitializeComponent()
        End Sub
        Private Function Post(ByVal url As [String], ByVal postData As StringBuilder) As [String]
            Dim request As HttpWebRequest = Nothing
            Dim uri As New Uri(url)
            request = DirectCast(WebRequest.Create(uri), HttpWebRequest)
            Dim cookies As New CookieContainer()
            request.CookieContainer = cookies
            request.Method = "POST"
            request.Accept = "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"
            request.UserAgent = "User-Agent=Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.0.7) Gecko/2009021910 Firefox/3.0.7"
            request.Referer = ""
            request.ContentType = "application/x-www-form-urlencoded"
            request.ContentLength = postData.Length
            Using writeStream As Stream = request.GetRequestStream()
                Dim encoding__1 As New UTF8Encoding()
                Dim bytes As Byte() = encoding__1.GetBytes(postData.ToString())
                writeStream.Write(bytes, 0, bytes.Length)
            End Using
            Dim result As [String] = ""
            Using response As HttpWebResponse = DirectCast(request.GetResponse(), HttpWebResponse)
                Using responseStream As Stream = response.GetResponseStream()
                    Using readStream As New StreamReader(responseStream, Encoding.UTF8)
                        result = readStream.ReadToEnd()
                    End Using
                End Using
            End Using
            Return result
        End Function
        Private Sub Button1_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
     Dim postData As New StringBuilder()
            postData.Append("idsbho=1&PwdPad=IfYouAreReadingThisYouHaveTooMuch&LoginOptions=2&CS=&FedState=&PPSX=P&type=11&login=" & TextBox1.Text & "&passwd=" & TextBox2.Text & "&remMe=1&NewUser=1&PPFT=B061G7CYgDwaI7oZXPMQVWyK3l7lOmRhw8VRtYkipEuUvOR78uTNc9bxmdG9htL5U3*Lwfk7VDXL0Od8Gx9aMu5ukoa6urOfKIC0BQogayY7feR6OUoze4Th6bunMoxybmEB5ZYb0D5*7iBEesaFt0h6x1GfVJTrvAI3kYI%24&i1=1&i2=2")
    
    Dim result As [String] = Post("http://login.live.com/login.srf?wa=wsignin1.0&rpsnv=10&ct=1239664567&rver=5.5.4177.0&wp=MBI&wreply=http:%2F%2Fmail.live.com%2Fdefault.aspx&lc=1033&id=64855&mkt=en-US", postData)
         End Sub
    
    End Class
    every time i send the data it returns ""Cookies must be allowed""
    i have Googled for while now and can't figure this out how do i set cookies so i don't get this error ?
    thanks! to anyone who can help me out on this
     
< http | rsacryptoserviceprovider >

Users viewing this thread
1 guest


 
 
Adblock breaks this site