[thelist] IIS 5: Is it Bad to Map .css to asp.dll?

Paul Cowan paul.cowan at wishlist.com.au
Thu May 17 18:14:38 CDT 2001

Hi James,

> But a partially formed thought occurred to me: what if I 
> mapped .css files to the asp.dll in IIS -- can I include 
> ASP code in a stand-alone CSS file to conditionally
> create a client-side style sheet?

This is easy enough to do, we've been doing it quite 
successfully for a while. One thing we do, though, is not map 
.css, but use a 'new' extension (.cssp, at the late hour I did
that it was the best I could think of - I guess it's a mix of
.asp and .cssp, which makes it Cascading Style Server Pages? 

Advantages of this way:
	* you can instantly tell from the file extension 
	  whether a given style sheet is standalone or 
	  allows the use of ASP constructs. 
	* slight speed gain for the vanilla .css files (if you
	  have any, as they won't need to go through the asp.dll
	* if you host other people's pure HTML on your 
	  machine, you can let them use .css without letting
	  them go through your ASP parser (potentially
	  executing malicious code)

I know the last one's a hypothetical, but I just thought of it,
and it seems worth mentioning.

The only 'gotcha' is to make sure that your .cssp files (or
whatever) have the line:
	response.contenttype = "text/css"
or asp.dll will default to sending text/html, which could have
any number of painful and hard-to-pin-down consequences in a given
browser. I think some Netscapes, for example, don't like stylesheets
that don't have the right MIME type.

There should be no security or other issues (as long as your box
is adequately secured anyway), obviously there will be a slight 
performance hit vs. just serving up plain text.



More information about the thelist mailing list