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( "Authoriza tion", "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.
--------------------------
<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(
Dim googleResponse = googleRequest.GetResponse(
outputLabel.Text = googleResponse.toString()
End Sub
</script>
--------------------------
The problem I now have is accessing the content of the "googleRequest.GetResponse
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
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
Check the following. This might help:
http://code.google.com/apis/contacts/docs/2.0/developers_guide_dotnet.html
https://github.com/bittercoder/DevDefined.OAuth
http://code.google.com/apis/contacts/docs/2.0/developers_guide_dotnet.html
https://github.com/bittercoder/DevDefined.OAuth
You're welcome. I think think the links provided by Alfred1 will help you further.
ASKER
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****
Do you (or anyone) have any experience of now using that to access the Google Shared Contacts Feed?