Solved

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

Posted on 2009-04-10
2
198 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

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

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

Suggested Solutions

Learn by example how to specify CSS selectors for Selenium WebDriver test automation software.
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 look for a specific file type in a local or remote server directory using PHP.
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…

910 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now