Solved

Response.AddHeader

Posted on 2001-08-19
8
379 Views
Last Modified: 2012-06-21
The Response object supports AddHeader which is suppose to add a custom header to the page that is being sent to the client.

To read that header in the Request Object you just read it as a server variable with the HTTP prefix.
 
What I am trying to do is to be able to set a guid as a header then read it whenever the page makes another call to the server. This is to avoid the use of the IIS sessions without having to append a guid as part of the form being submitted or querystring for all links on every page.
 
So the design would be:
 
A person requests a page.
As the page is being created a custom header is added (Response.AddHeader("GUID",strSessionGUID)
The person views the page then clicks on a link or submits a form.
The request is processed and I grab the custom header (Request.ServerVariables("HTTP_GUID")) to find out what their session guid.

Can this be done? Most of my research points to no, but that is why I turn to all of you. If not, what is another way to pass a guid to the client and back to the server without using cookies and without having to add the information to every link and form submission?

Thanks,

Kent
0
Comment
Question by:kfehriba
  • 4
  • 3
8 Comments
 
LVL 28

Expert Comment

by:AzraSound
Comment Utility
The ServerVariables collection of the Request object contains only those headers sent from the client to the server, and since the header created via the AddHeader method is done at the server, it is lost, unless it is also defined at the client, when you attempt to request it on your next page.  Its just not part of the ServerVariables collection.
0
 
LVL 28

Expert Comment

by:AzraSound
Comment Utility
>>what is another way to pass a guid to the client and back to the server

There are really only 3 ways, and commercial products that emulate the Session object all use one of these:

1) Cookies/Built-in Session Object
2) Append GUID to every URL
3) Write GUID to hidden input element on every page


Even the Cookie Munger from MS resorted to appending the GUID to the URL.  Of course, I'd be more than happy to be proven wrong...
0
 
LVL 5

Expert Comment

by:raizon
Comment Utility
I agree with AzraSound.  You will find that most Companies/Sites append the GUID to the URL.
0
 
LVL 1

Author Comment

by:kfehriba
Comment Utility
Azra,

You state, "since the header created via the AddHeader method is done at the server, it is lost". But it isn't 'lost' at the server is it? I thought that it is sent to the client. And the client does have the capability of returining headers to the server? Is this just a problem that the server does not know how to read those headers or does the client not return those headers?

Kent
0
What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

 
LVL 28

Accepted Solution

by:
AzraSound earned 100 total points
Comment Utility
>>Is this just a problem that the server does not know how to read those headers or does the client not return those headers?

Its because the client does not return those headers.  You can send a custom header to the client, which, if programmed to do so, will respond to that header.  But the client then sends back headers to the server that it is programmed to do so, which the header you created at the server is not one of.
0
 
LVL 1

Author Comment

by:kfehriba
Comment Utility
Can the client view the custom headers using java script, if so, what is the code?

Kent
0
 
LVL 28

Expert Comment

by:AzraSound
Comment Utility
To be honest, I have no idea.  Perhaps you can post a question asking this in the Javascript topic area.
0
 
LVL 1

Author Comment

by:kfehriba
Comment Utility
Thanks for the input.
0

Featured Post

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

I have helped a lot of people on EE with their coding sources and have enjoyed near about every minute of it. Sometimes it can get a little tedious but it is always a challenge and the one thing that I always say is:  The Exchange of information …
I would like to start this tip/trick by saying Thank You, to all who said that this could not be done, as it forced me to make sure that it could be accomplished. :) To start, I want to make sure everyone understands the importance of utilizing p…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

743 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

12 Experts available now in Live!

Get 1:1 Help Now