courtthree
asked on
ASP.NET (vb.net) custom HTTP headers
Hi All,
The wider picture to this problem is the integration of an ASP.NET application with Google Apps - but that is a way down the line for now.
All I am trying to do at this stage is append the HTTP Header of a page and pass it to another page (which is the basic premise of Google AuthSub for Google Apps).
In the following file: http://www.********.com/header1.aspx I have the following Sub Page_Load:
-------------------------- ---------- ---
Sub Page_Load(Sender As Object, E As EventArgs)
Response.AppendHeader("Tes t", "Test")
Response.Redirect("header2 .aspx")
End Sub
-------------------------- ---------- ---
The simplest of things that *should* add the header "Test" to the GET Request for "header2.aspx". However, header2.aspx does not output a header value called "Test"!
Header 2 simply has this in the body:
-------------------------- ---------- ---
<%= Request.ServerVariables("A LL_HTTP") %>
-------------------------- ---------- ---
This is mad because it's so simple which is kind of why I am lost - there is not much documentation online for such a straightforward issue.
Any help will be massively appreciated.
The wider picture to this problem is the integration of an ASP.NET application with Google Apps - but that is a way down the line for now.
All I am trying to do at this stage is append the HTTP Header of a page and pass it to another page (which is the basic premise of Google AuthSub for Google Apps).
In the following file: http://www.********.com/header1.aspx I have the following Sub Page_Load:
--------------------------
Sub Page_Load(Sender As Object, E As EventArgs)
Response.AppendHeader("Tes
Response.Redirect("header2
End Sub
--------------------------
The simplest of things that *should* add the header "Test" to the GET Request for "header2.aspx". However, header2.aspx does not output a header value called "Test"!
Header 2 simply has this in the body:
--------------------------
<%= Request.ServerVariables("A
--------------------------
This is mad because it's so simple which is kind of why I am lost - there is not much documentation online for such a straightforward issue.
Any help will be massively appreciated.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks Alfred,
That does start to point me in the right direction but the solution offered in that link doesn't work directly.
Given the nature of this code block:
-------------------------- ---------- ---
Sub Page_Load(Sender As Object, E As EventArgs)
Response.AppendHeader("Tes t", "Test")
Response.Redirect("header2 .aspx")
End Sub
-------------------------- ---------- ---
Can you tell me how the redirect should work?
That does start to point me in the right direction but the solution offered in that link doesn't work directly.
Given the nature of this code block:
--------------------------
Sub Page_Load(Sender As Object, E As EventArgs)
Response.AppendHeader("Tes
Response.Redirect("header2
End Sub
--------------------------
Can you tell me how the redirect should work?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thank you for your continued input but I have no discovered that using the methids described above send the headers as "Response" and Google requires "Request" objects!
I have now written the following which gets me through Google authentication:
-------------------------- ---------- ---------- -----
<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.
However, I realise that your previous answers were correct for the original question so I think it would only be fair if I accept your answer and post this as a new question. By all means, go and answer the new one!
I have now written the following which gets me through Google authentication:
--------------------------
<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
However, I realise that your previous answers were correct for the original question so I think it would only be fair if I accept your answer and post this as a new question. By all means, go and answer the new one!
And Google is trying to move everything to OAuth ... if you can, stay away from ClientLogin & AuthSub.
Ss