473,769 Members | 4,173 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.Append Header("MYKEY", "myValue")

and do a redirect to SecondPage.aspx

Response.Redire ct("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","Use r-
Agent" etc....

Can anyone enlighten me???

Thanks .. :)
Shelly
Nov 18 '05 #1
5 6860
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*******@disc ussions.microso ft.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.Append Header("MYKEY", "myValue")

and do a redirect to SecondPage.aspx

Response.Redire ct("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","Use r-
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.redire ct, 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.redire ct ?? 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*******@disc ussions.microso ft.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.Append Header("MYKEY", "myValue")

and do a redirect to SecondPage.aspx

Response.Redire ct("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","Use r-
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.redire ct, 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.redire ct ?? 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*******@disc ussions.microso ft.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.Append Header("MYKEY", "myValue")

and do a redirect to SecondPage.aspx

Response.Redire ct("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","Use r-
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*******@disc ussions.microso ft.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.Append Header("MYKEY", "myValue")

and do a redirect to SecondPage.aspx

Response.Redire ct("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","Use r-
Agent" etc....

Can anyone enlighten me???

Thanks .. :)
Shelly

Nov 18 '05 #5
"Shelly" <an*******@disc ussions.microso ft.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.Append Header("MYKEY", "myValue")

and do a redirect to SecondPage.aspx

Response.Redire ct("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
3944
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 using server-side session features. The way I have typically done this in the ASP world was with cookies. Another way to handle this is with a keyed record in a database, but the cookie strategy reduces the number of times I need to hit a...
3
5651
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 learned to use functions and to create our own. The problem is we never learned to place them in header files. To me, and obviously, I'm not that experienced with C, it would be better to place user created functions in separate header files...
3
2823
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 Response.AddHeader("ID","value"), the key or value doesnt appear in the Request.Headers collection. What could be reason to this problem? Does ASP.NET support setting and viewing custom http
2
2446
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 fine. However, when attempting to assing default values as designtime in the propertygrid, nothing is working on the class object. I know that I am doing it wrong, any ideas what it is? Thanks in advance
0
3735
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 BEFORENAVIGATE2, I am canceling the current navigation and renavigating with the new custom header using Navigate2. This usually works fine, but in some cases (particularly when selecting a link that starts a new window), the Navigate2 call fails.
3
7068
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 automatically adds headers such as "Content-Length: 0". This causes an error on the client. HttpResponse.ClearHeaders() doesn't help. How to make asp not to add headers (especially Content- Length)? Thanks in advance.
0
3696
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 calling a Web Method using this proxy class. I could add the SOAP security header using Assertion Policy. But adding HTTP headers looks like a challenge. Basically I am trying to resolve the soap fault "The request failed with HTTP status 404:...
0
2248
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 application specific headers are to be added in the print out. Problem: The System.Drawing.Printing namespace .Net provides objects and dialogs to take care of basic print tasks. But there is no native support of printing RTF and HTML formats. One would...
0
1359
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 supported on this platform." error. BigJim has a nice post on the subject here: http://bigjimindc.blogspot.com/2007/07/ms-kb928365-aspnet-requestheadersadd.html
0
9589
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9423
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10211
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10045
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9863
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8872
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5447
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3959
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3562
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.