Link to home
Create AccountLog in
Avatar of courtthree
courtthree

asked on

HTTP Request Headers in VB.NET

I am attempting to integrate Google Shard contacts with an ASP.NET application. I have successfully implemented the first part of their procedure which is to authenticate the application with the Google account using the code below:

---------------------------------------------------

<script runat="server">

Dim t As String

Sub Page_Load(Sender As Object, E As EventArgs)

      t = Request.QueryString("token")
      
      Dim googleRequest = HttpWebRequest.Create("https://www.google.com/accounts/AuthSubSessionToken")
      googleRequest.Method = "GET"
      googleRequest.Headers.Set("Authorization", "AuthSub token=""" & t & """")
      Dim googleResponse = googleRequest.GetResponse()
      
      outputLabel.Text = googleResponse.toString()
      
End Sub

</script>

---------------------------------------------------

The problem I now have is accessing the content of the "googleRequest.GetResponse()" method.

Please note that I am not necessarily looking for a "Google-specific" answer here (but please feel free to give one) but really an explanation of how to extract the data returned inside the "GetResponse()" method of the HttpWebRequest.

NB: I know it's hard but please do not come back with comments like, "you need to do it in jsp or c# etc!" I am looking for a vb.net solution please.
SOLUTION
Avatar of Alfred A.
Alfred A.
Flag of Australia image

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer
ASKER CERTIFIED SOLUTION
Avatar of Dennis Aries
Dennis Aries
Flag of Netherlands image

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
Avatar of courtthree
courtthree

ASKER

WOW!

With the help of you two guys, I have progressed further with this in 12 hours than I have in two weeks.

@djjaries, the code you supplied has beautifully returned the session token as a string in the following format (Modified for secuity):

Token=1/t__mrBs9xEtKMo*********************IOX5rj1iGN74

Do you (or anyone) have any experience of now using that to access the Google Shared Contacts Feed?
You're welcome. I think think the links provided by Alfred1 will help you further.