Solved

Include HTTP Headers in ASP/HTML pages. How?

Posted on 2002-05-09
7
208 Views
Last Modified: 2013-11-18
I recently made our site P3P compliant, and a requirement is to follow the procedure I am enumerating next:

INTERNET INFORMATION SERVER
1. Open the IIS Administration Console.
2. Open the Properties screen for the webserver.
3. Click on the 'HTTP Headers' tab.
4. Click 'Add' in the 'Custom HTTP Headers' area.
5. A new window appears.
6. Type 'P3P' (without quotes) in the 'Custom Header Name' text field.
7. Copy and paste the following string
 
CP="NOI DSP COR NID"
 
into the 'Custom Header Value' text field (this time include the quotes).
 
8. Select OK and exit out of the IIS Admin.

I send this procedure to my ISP to do it and they replied that they are not able to do this, and in return I should include these headers in my ASP page. So, how do I include this CP=" ... " P3P header in my ASP?

Thank you
GM
0
Comment
Question by:gm395
  • 5
  • 2
7 Comments
 
LVL 23

Expert Comment

by:b1xml2
ID: 6999331
<%
 Response.Buffer = True
 Response.AddHeader "CP" ,"whatever value"
%>

Syntax is:
Response.AddHeader <header_name>,<header_value>

Caution:
Adding headers can be successfully done if no content has yet to be sent to the client.

Recommendation:
 Set the Response.Buffer = True to ensure that the entire page gets sent as one and not in chunks.
0
 
LVL 23

Expert Comment

by:b1xml2
ID: 6999335
Here, having read what you require:
==================================
<%
Response.AddHeader "P3P","CP='NOI DSP COR NID'"
%>
0
 
LVL 23

Expert Comment

by:b1xml2
ID: 6999354
As for HTML Pages,
<html>
<head>
<meta name="P3P" content="CP='NOI DSP COR NID'">
<title>My Page</title>
</head>
<body>
</body>
</html>
0
Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

 
LVL 1

Author Comment

by:gm395
ID: 6999435
I will check it tomorrow at work and let you know. Thanks in advance.
0
 
LVL 1

Author Comment

by:gm395
ID: 7003182
The problem with the ASP solution you have given me is the fact that it uses single quotes, whereas I require double quotes. So the header set is the:

P3P: CP='NOI DSP COR NID'

instead of

P3P: CP="NOI DSP COR NID"

The code I am using at the beginning of my ASP file is:

<% @language=vbscript %>
<%
Response.Buffer = True
Response.AddHeader "P3P","CP='NOI DSP COR NID'"
%>

and the error I get is:

Message: Compact Policy must be quoted by double quotation marks ("). Single quotation marks are not allowed.

Any help with this? Additionally, if I use the HTML tag, it does not seem to work, in an ASP file (which at the end of the day returns some HTML code).

Thanks
0
 
LVL 23

Accepted Solution

by:
b1xml2 earned 100 total points
ID: 7003197
Response.AddHeader "P3P","CP=""NOI DSP COR NID"""

You can use the double quotes then =)
0
 
LVL 23

Expert Comment

by:b1xml2
ID: 7003199
i doubt that the meta tag would work in the same way as the AddHeader as that is a HTTP Header whereas the meta tag's success depends on the browser implementation. I would say that you'd have to use ASP for this task.
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

This article explains how to prepare an HTML email signature template file containing dynamic placeholders for users' Azure AD data. Furthermore, it explains how to use this file to remotely set up a department-wide email signature policy in Office …
Finding original email is quite difficult due to their duplicates. From this article, you will come to know why multiple duplicates of same emails appear and how to delete duplicate emails from Outlook securely and instantly while vital emails remai…
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

840 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