Solved

How do I append a custom header and then retrieve it?

Posted on 2009-04-10
2
199 Views
Last Modified: 2013-11-19
I am having all kinds of problems with something that should be fairly straight forward and simple.  I want to add a custom header using Request.AppendHeader(name, value) then when the page is displayed be able to get the custom header.  But when I try it I get an error that object not set to instance of object error.  See code below.  Really need help not a link to some other page which doesn't answer the question.  Must have viewed 100 of them.
Here is where I append the header
Response.AppendHeader("ReserveHeader", "navyreserve.navy.mil");              Response.Redirect(sbURL.ToString());
              
  This line throws the error on the page cited in sbURL
string Header = Request.ServerVariables["HTTP_ReserveHeader"].ToString();

Open in new window

0
Comment
Question by:mbart
2 Comments
 
LVL 42

Accepted Solution

by:
David S. earned 500 total points
ID: 24120988
What you are trying to do is not possible.  Server-side code, like ASP, is only processed on the server, and client-side JavaScript can't access most HTTP headers.
0
 

Author Closing Comment

by:mbart
ID: 31569059
Thanks, afraid of that. Will follow-up with another question along the same lines.
0

Featured Post

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Although it can be difficult to imagine, someday your child will have a career of his or her own. He or she will likely start a family, buy a home and start having their own children. So, while being a kid is still extremely important, it’s also …
Any business that wants to seriously grow needs to keep the needs and desires of an international audience of their websites in mind. Making a website friendly to international users isn’t prohibitively expensive and can provide an incredible return…
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
Any person in technology especially those working for big companies should at least know about the basics of web accessibility. Believe it or not there are even laws in place that require businesses to provide such means for the disabled and aging p…

832 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question