Setting Far Futures Expires in ASP, Using ASP as CSS

I normally don’t work with ASP; I use PHP for my coding. Recently, I had to create a style.css.asp file, and I needed to find how to set a far-futures header in ASP. 

Here’s what I found in 5 minutes 🙂 :
<%
Response.ContentType = "text/css"
Response.ExpiresAbsolute=#May 05,2031 05:30:30#
%>

I normally write code in PHP, where I have a standard piece of code I use to gzip my style.css.php files, set a far futures expire date, and declare them CSS, instead of PHP:
<?php
header("Content-type: text/css");
header('ExpiresDefault "access plus 10 years"');
if (substr_count($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip')) ob_start("ob_gzhandler"); else ob_start();
?>

This is kind of a note-to-self, but hopefully it helps you out! Anyone have better code they’d like to share?

Author: Zack Katz

Zack Katz is the creator of GravityView and the President of Katz Web Services. He lives in Denver with his wife and cute beast of a cat.

Leave a Reply

Your email address will not be published. Required fields are marked *