472,328 Members | 1,131 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,328 software developers and data experts.

Custom HTTP headers problem

hi,

I am trying to create a custom HTTP header and trying to
access that variable on another ASP.NET webpage.

Following is the code base-
I use the following code to set the header
Response.AppendHeader("MYKEY", "myValue")

and do a redirect to SecondPage.aspx

Response.Redirect("SecondPage.aspx")

In the second page, I try to retrieve the value using the
following code

Response.Write(Request.Headers.Get("MYKEY"))

I dont see any reponse back. Am I setting the header in a
inapproriate way? What is the reason y i am not able to
see my custom http header on the destination page. I am
able to get the standard http headers like "Host","User-
Agent" etc....

Can anyone enlighten me???

Thanks .. :)
Shelly
Nov 18 '05 #1
5 6775
Shelly,
I was just thinking about how this would behave, and one of my
thoughts is, the AppendHeader will place the new header at the end of the
queue. In all likelyhood this would actually occur after the 302 redirect is
sent. I'm not sure that in the case of a redirect that it will actually ever
be picked up by the browser since after the redirect is received everything
gets thrown away. Unless you're emitting the headers from a global function
for all pages, I'm not sure that they'll transfer like this.

Hope this helps,
Mark Fitzpatrick
Microsoft MVP - FrotnPage

"Shelly" <an*******@discussions.microsoft.com> wrote in message
news:05****************************@phx.gbl...
hi,

I am trying to create a custom HTTP header and trying to
access that variable on another ASP.NET webpage.

Following is the code base-
I use the following code to set the header
Response.AppendHeader("MYKEY", "myValue")

and do a redirect to SecondPage.aspx

Response.Redirect("SecondPage.aspx")

In the second page, I try to retrieve the value using the
following code

Response.Write(Request.Headers.Get("MYKEY"))

I dont see any reponse back. Am I setting the header in a
inapproriate way? What is the reason y i am not able to
see my custom http header on the destination page. I am
able to get the standard http headers like "Host","User-
Agent" etc....

Can anyone enlighten me???

Thanks .. :)
Shelly

Nov 18 '05 #2
Thanks very much Mark,

really appreciate your help. As per your explanation, when
I do a response.redirect, I would loose all the header
information which I set, am i right?

the scenario is like this. i have an application which
send me some information in the HTTP header. As a testing
effort, before intergrating to the application, I wanted
to simulate the scenario where I could trap and header
info thro the request object. But how do i set the custom
HTTP header and pass it to my destination page, without a
response.redirect ?? can you suggest the ways for testing
the custom http header retrieval??

Thanks a bunch... :)
Shelly
-----Original Message-----
Shelly,
I was just thinking about how this would behave, and one of mythoughts is, the AppendHeader will place the new header at the end of thequeue. In all likelyhood this would actually occur after the 302 redirect issent. I'm not sure that in the case of a redirect that it will actually everbe picked up by the browser since after the redirect is received everythinggets thrown away. Unless you're emitting the headers from a global functionfor all pages, I'm not sure that they'll transfer like this.
Hope this helps,
Mark Fitzpatrick
Microsoft MVP - FrotnPage

"Shelly" <an*******@discussions.microsoft.com> wrote in messagenews:05****************************@phx.gbl...
hi,

I am trying to create a custom HTTP header and trying to access that variable on another ASP.NET webpage.

Following is the code base-
I use the following code to set the header
Response.AppendHeader("MYKEY", "myValue")

and do a redirect to SecondPage.aspx

Response.Redirect("SecondPage.aspx")

In the second page, I try to retrieve the value using the following code

Response.Write(Request.Headers.Get("MYKEY"))

I dont see any reponse back. Am I setting the header in a inapproriate way? What is the reason y i am not able to
see my custom http header on the destination page. I am
able to get the standard http headers like "Host","User-
Agent" etc....

Can anyone enlighten me???

Thanks .. :)
Shelly

.

Nov 18 '05 #3
Thanks very much Mark,

really appreciate your help. As per your explanation, when
I do a response.redirect, I would loose all the header
information which I set, am i right?

the scenario is like this. i have an application which
send me some information in the HTTP header. As a testing
effort, before intergrating to the application, I wanted
to simulate the scenario where I could trap and header
info thro the request object. But how do i set the custom
HTTP header and pass it to my destination page, without a
response.redirect ?? can you suggest the ways for testing
the custom http header retrieval??

Thanks a bunch... :)
Shelly
-----Original Message-----
Shelly,
I was just thinking about how this would behave, and one of mythoughts is, the AppendHeader will place the new header at the end of thequeue. In all likelyhood this would actually occur after the 302 redirect issent. I'm not sure that in the case of a redirect that it will actually everbe picked up by the browser since after the redirect is received everythinggets thrown away. Unless you're emitting the headers from a global functionfor all pages, I'm not sure that they'll transfer like this.
Hope this helps,
Mark Fitzpatrick
Microsoft MVP - FrotnPage

"Shelly" <an*******@discussions.microsoft.com> wrote in messagenews:05****************************@phx.gbl...
hi,

I am trying to create a custom HTTP header and trying to access that variable on another ASP.NET webpage.

Following is the code base-
I use the following code to set the header
Response.AppendHeader("MYKEY", "myValue")

and do a redirect to SecondPage.aspx

Response.Redirect("SecondPage.aspx")

In the second page, I try to retrieve the value using the following code

Response.Write(Request.Headers.Get("MYKEY"))

I dont see any reponse back. Am I setting the header in a inapproriate way? What is the reason y i am not able to
see my custom http header on the destination page. I am
able to get the standard http headers like "Host","User-
Agent" etc....

Can anyone enlighten me???

Thanks .. :)
Shelly

.

Nov 18 '05 #4
I believe I read in old ASP, that custom headers, thought they may be sent,
were not parsed into the Request object.
I would imagine the same rule applies to ASP.NET

"Shelly" <an*******@discussions.microsoft.com> wrote in message
news:05****************************@phx.gbl...
hi,

I am trying to create a custom HTTP header and trying to
access that variable on another ASP.NET webpage.

Following is the code base-
I use the following code to set the header
Response.AppendHeader("MYKEY", "myValue")

and do a redirect to SecondPage.aspx

Response.Redirect("SecondPage.aspx")

In the second page, I try to retrieve the value using the
following code

Response.Write(Request.Headers.Get("MYKEY"))

I dont see any reponse back. Am I setting the header in a
inapproriate way? What is the reason y i am not able to
see my custom http header on the destination page. I am
able to get the standard http headers like "Host","User-
Agent" etc....

Can anyone enlighten me???

Thanks .. :)
Shelly

Nov 18 '05 #5
"Shelly" <an*******@discussions.microsoft.com> wrote in message
news:05****************************@phx.gbl...
hi,

I am trying to create a custom HTTP header and trying to
access that variable on another ASP.NET webpage.

Following is the code base-
I use the following code to set the header
Response.AppendHeader("MYKEY", "myValue")

and do a redirect to SecondPage.aspx

Response.Redirect("SecondPage.aspx")

In the second page, I try to retrieve the value using the
following code

Response.Write(Request.Headers.Get("MYKEY"))


AppendHeader would add the header to the response. The response is the 302
message redirecting to SecondPage.aspx. I'm sure the user's browser receives
the 302 page along with your custom header, but why would it send the header
back when it requests SecondPage.aspx?
--
John Saunders
John.Saunders at SurfControl.com
Nov 18 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Google Mike | last post by:
Tell me if this can be done, and if I have a misconception here. I am writing an app that will be served up in an app farm, and therefore I need...
3
by: Jared | last post by:
Hi, Can someone explain the basic structure of a header file? I just completed a introductory C programming class. The course stressed...
3
by: Jacky | last post by:
hi, I am trying to view the custom headers in an ASP.NET page. I am able to view all the standard headers using the method...
2
by: AMDRIT | last post by:
Hello everyone, I have created a custom component and one of its properties is a class object with it's own properties. During runtime, I can...
0
by: Dean Hallman | last post by:
Hello, I am developing a BHO that should add a custom HTTP header on a specific domain only. Don't want the header globally, otherwise I could...
3
by: Alexander Smirnov | last post by:
I'm developing asp.net 2 web application and need to make a custom http handler which sometime must send response with "204 No Content" code. I...
0
by: Nithi Gurusamy | last post by:
I have generated a Web-Service-Proxy (Add Web Reference) within VS. This proxy class is based on WebServicesClientProtocol of WSE 3.0. I want to...
0
by: nikhilgargi | last post by:
Requirement: I need to provide printing capability in a C# desktop application that I am developing The documents that need to be printed can be in...
0
by: msnews.microsoft.com | last post by:
Hi, I need to create and add custom headers to an ASP.NET 2.0 application. The case is simulation of an SSO-login in our dev/test environment. ...
0
by: tammygombez | last post by:
Hey everyone! I've been researching gaming laptops lately, and I must say, they can get pretty expensive. However, I've come across some great...
0
by: concettolabs | last post by:
In today's business world, businesses are increasingly turning to PowerApps to develop custom business applications. PowerApps is a powerful tool...
0
by: teenabhardwaj | last post by:
How would one discover a valid source for learning news, comfort, and help for engineering designs? Covering through piles of books takes a lot of...
0
by: Kemmylinns12 | last post by:
Blockchain technology has emerged as a transformative force in the business world, offering unprecedented opportunities for innovation and...
0
by: CD Tom | last post by:
This happens in runtime 2013 and 2016. When a report is run and then closed a toolbar shows up and the only way to get it to go away is to right...
0
by: antdb | last post by:
Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine In the overall architecture, a new "hyper-convergence" concept was...
0
by: Matthew3360 | last post by:
Hi there. I have been struggling to find out how to use a variable as my location in my header redirect function. Here is my code. ...
1
by: Matthew3360 | last post by:
Hi, I have a python app that i want to be able to get variables from a php page on my webserver. My python app is on my computer. How would I make it...
0
by: AndyPSV | last post by:
HOW CAN I CREATE AN AI with an .executable file that would suck all files in the folder and on my computerHOW CAN I CREATE AN AI with an .executable...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.