Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

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

Posted on 2009-04-10
2
Medium Priority
?
217 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 43

Accepted Solution

by:
David S. earned 1500 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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

When the s#!t hits the fan, you don’t have time to look up who’s on call, draft emails, call collaborators, or send text messages. An instant chat window is definitely the way to go, especially one like HipChat. HipChat is a true business app. An…
Ready to get certified? Check out some courses that help you prepare for third-party exams.
Viewers will get an overview of the benefits and risks of using Bitcoin to accept payments. What Bitcoin is: Legality: Risks: Benefits: Which businesses are best suited?: Other things you should know: How to get started:
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…
Suggested Courses

670 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