Dim mail As String = "email"
        Dim pwd As String = "pwd"
        Dim encoding As ASCIIEncoding = New ASCIIEncoding
        Dim postdata As String = ""
        postdata = postdata & "accountType=HOSTED"
        postdata = postdata & "&Email=" & Server.UrlEncode(mail)
        postdata = postdata & "&Passwd=" & Server.UrlEncode(pwd)
        postdata = postdata & "&service=apps"
        Dim data As Byte() = encoding.GetBytes(postdata)


        Dim myrequest As HttpWebRequest =
HttpWebRequest.Create("https://www.google.com/accounts/ClientLogin";)
        myrequest.Method = "POST"
        myrequest.ContentType = "application/x-www-form-urlencoded"
        myrequest.ContentLength = data.Length
        Dim newstream As Stream = myrequest.GetRequestStream()
        Dim myWriter As New StreamWriter(myrequest.GetRequestStream())



        Try
            myWriter.Write(postdata)
        Catch ex As Exception
            Response.Write(Err.Description)
        Finally
            myWriter.Close()
        End Try


        Dim objresponse As HttpWebResponse = myrequest.GetResponse
        Dim sr As StreamReader = New
StreamReader(objresponse.GetResponseStream)
        Dim resultat As String = Server.UrlDecode(sr.ReadToEnd)

        Dim pos As Integer = InStr(resultat, "Auth=")
        resultat = resultat.Substring(pos + 4)
        sr.Close()

        return (resultat)
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Apps APIs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/google-apps-apis?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to