Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 225
  • Last Modified:

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

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
mbart
Asked:
mbart
1 Solution
 
David S.Commented:
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
 
mbartAuthor Commented:
Thanks, afraid of that. Will follow-up with another question along the same lines.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Get 10% Off Your First Squarespace Website

Ready to showcase your work, publish content or promote your business online? With Squarespace’s award-winning templates and 24/7 customer service, getting started is simple. Head to Squarespace.com and use offer code ‘EXPERTS’ to get 10% off your first purchase.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now