Solved

Include HTTP Headers in ASP/HTML pages. How?

Posted on 2002-05-09
7
205 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
What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 
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

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Align a <div> to a table row 3 38
Hover Gone 16 30
Newbie CSS questions 4 25
how to get responsive video to always be centered 15 37
Styling your websites can become very complex. Here I'll show how SASS can help you better organize, maintain and reuse your CSS code.
This article discusses four methods for overlaying images in a container on a web page
In this tutorial viewers will learn how to embed Flash content in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: "<!DOCTYPE html>": Use the <object> tag to embed Flash content.: To specify that the object is Flash content, d…
In this tutorial viewers will learn how to embed videos in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: "<!DOCTYPE html>": Use the <video> tag to insert a video. Define the src as the URL of your video; this is similar to …

708 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

18 Experts available now in Live!

Get 1:1 Help Now