Web Request/Response issue

jamie_pattison

Well-known member
Joined
Sep 9, 2008
Messages
116
Programming Experience
Beginner
My code to date is

VB.NET:
Dim webRequest As System.Net.HttpWebRequest
Dim webResponse As System.Net.HttpWebResponse

SendPostRequesttoGoogle("https://www.google.com/accounts/ClientLogin") ' This includes the post data [B][I]"accountType=HOSTED_OR_GOOGLE&Email=email.add@gmail.com&Passwd=secretPassword&service=finance&source=Comp-Company-.01"[/I][/B]

            webRequest = WebRequest.Create("http://finance.google.com/finance/feeds/default/portfolios")
            webRequest.Headers.Add("GData Version: ", "2")
            webRequest.Headers.Add("Authorization GoogleLogin auth=", AuthorizationCode)

                webResponse = webRequest.GetResponse()
                 If webResponse.StatusCode = HttpStatusCode.OK Then
                        Dim responseStream As System.IO.Stream = webResponse.GetResponseStream()
                        Dim responseEncoding As System.Text.Encoding = System.Text.Encoding.UTF8
                        Dim responseReader As New StreamReader(responseStream, responseEncoding)
                        Dim responseContent As String = responseReader.ReadToEnd()
                        Return responseContent

I get a 403 exception (Forbidden). I am sending in the Authorization code in the format GGTOJOefjiof.... When i break down my code to see if i can authenticate by trying to logon to Googles service then i get 200 Response (Ok) (SendPostRerquestToGoogle code does this bit and it works).

Could anyone assist in how to make a successful call to retrieve/view the portfolios on Google, or what i could be doing wrong with the above code?

Thanks
 
Last edited:
Back
Top