473,320 Members | 1,719 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 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 6834
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 to move the session information to the client, not...
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 structured programming and creating reusable code. We...
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 Request.Headers.Get(). But if i set a custom header using...
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 assign values to the class object properties just...
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 just add a registry key. So, on...
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 set HttpResponse.Status="204 No Content"; But asp...
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 add some custom HTTP Headers to the envelop before...
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 Rich Text Format (RTF) or HTML. Custom...
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. When I try to add headers I run into the "Not...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.