Solved

Response.AddHeader

Posted on 2001-08-19
8
381 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
ID: 6404288
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
ID: 6404476
>>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
ID: 6404537
I agree with AzraSound.  You will find that most Companies/Sites append the GUID to the URL.
0
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 
LVL 1

Author Comment

by:kfehriba
ID: 6406072
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
 
LVL 28

Accepted Solution

by:
AzraSound earned 100 total points
ID: 6406359
>>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
ID: 6406407
Can the client view the custom headers using java script, if so, what is the code?

Kent
0
 
LVL 28

Expert Comment

by:AzraSound
ID: 6406568
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
ID: 6406592
Thanks for the input.
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

Title # Comments Views Activity
how to hide hide popup page refresh second time? 10 125
Connection String to remote Server not working 3 87
Select only the top record in a left join 13 35
innerHTML 7 19
Have you ever needed to get an ASP script to wait for a while? I have, just to let something else happen. Or in my case, to allow other stuff to happen while I was murdering my MySQL database with an update. The Original Issue This was written…
This demonstration started out as a follow up to some recently posted questions on the subject of logging in: http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q_28634665.html and http://www.experts-exchange.com/Programming/…
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

777 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