UPDATE 1:
I have now setup IIS6 so .NET can handle calls to .css files. What do I have to do now to get it to change css files based on the referal
I wouldn't recommend using httpModule
as it will be called upon for each and every request which might deteriorate performance. Whereas, you can use httpHandlers
to handle only specific paths. Therefore, my vote would be to use httpHandlers
.
But there is a glitch. By default, IIS 6 does not pass requests for non ASP.Net extension (read extensions other than .aspx, .ashx, .axd and all that) to ASP.Net by default.
Therefore, you need to add ISAPI module for CSS extension to pass the request to aspnet_isapi.dll (you can find the complete path from .aspx extension handler).
This link might help in setting up ISAPI module.
Once ASP.Net has started handling .CSS
extension, write a httpHandler
with your logic and add the following line under httphandlers
section in web.config
file
Say your httpHandler is CSSHttpHandler
then the code would be something like this.
Hope this helps.