Implementing PICS and P3P in ASP.NET Headers
If your website targets children, maybe you sell toys, you should know about products like NetNanny that blocks access to certain websites based upon a lot of parameters.
It’s for the protection of children that parents install these website blockers to keep their youngsters from accessing websites containing violence, nudity etc.
That’s why the World Wide Web Consortium created PICS.
You can then label your website with a set of codes that tell products like NetNanny about the content of your site.
If you don’t label your website, you run the risk of being blocked by these kinds of products.
P3P is about securing the users privacy and for web developers it’s about the permission to set cookies on the user’s browser.
Well, that and other things which are not important right now. Internet Explorer supports it very well, which makes it a no-brainer to implement, since it’s the worlds most used browser.
You could risk that a user does not accept your cookies and that could ruin his or hers experience on your site. If you are about to create third-party cookies, you definitely need a P3P policy.
It is normally quite cumbersome to creating P3P policy files and creating a PICS label from ICRA, but I’ve done it for your, so don’t look any longer.
Just place this method in the global.asax file on your website and you’re good to go.
Private Sub Global_BeginRequest(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.BeginRequest
Response.AddHeader("P3P", "CP=""NOI DSP COR ADMa IVDa OUR NOR""")
Response.AddHeader("Pics-Label", "(pics-1.1 ""http://www.icra.org/ratingsv02.html"" l gen true for ""http://" & Request.Url.Host & """ r (nz 1 vz 1 lz 1 oz 1 cz 1))")
Remember, this is a quick fix – not the whole shebang, but it works. Enjoy.
Mads Kristensen currently works as a Senior Developer at Traceworks located
in Copenhagen, Denmark. Mads graduated from Copenhagen Technical Academy with a multimedia degree in
2003, but has been a professional developer since 2000. His main focus is on ASP.NET but is responsible for Winforms, Windows- and
web services in his daily work as well. A true .NET developer with great passion for the simple solution.