Go Premium for a chance to win a PS4. Enter to Win

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

Include HTTP Headers in ASP/HTML pages. How?

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
gm395
Asked:
gm395
  • 5
  • 2
1 Solution
 
b1xml2Commented:
<%
 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
 
b1xml2Commented:
Here, having read what you require:
==================================
<%
Response.AddHeader "P3P","CP='NOI DSP COR NID'"
%>
0
 
b1xml2Commented:
As for HTML Pages,
<html>
<head>
<meta name="P3P" content="CP='NOI DSP COR NID'">
<title>My Page</title>
</head>
<body>
</body>
</html>
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
gm395Author Commented:
I will check it tomorrow at work and let you know. Thanks in advance.
0
 
gm395Author Commented:
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
 
b1xml2Commented:
Response.AddHeader "P3P","CP=""NOI DSP COR NID"""

You can use the double quotes then =)
0
 
b1xml2Commented:
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

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

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