Can .NET intercept and change css files?

前端 未结 7 521
渐次进展
渐次进展 2021-01-11 11:42

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

7条回答
  •  -上瘾入骨i
    2021-01-11 12:13

    Yes, you should be able to use an HttpModule on your "old" application to intercept the calls to the old CSS. Based on the version of IIS you have on your server, you may need to do some configuration to make sure .NET is handling calls to .css files, otherwise your HttpModule would not be called. See this question for reference.

    Once .NET is handling calls to CSS, you can dynamically switch the css dynamically in case the request is for the "old" css file.

    Here's an old article (since you are on .NET 1.1) that should point you in the right direction for the implementation and the configuration of IIS: "URL Rewriting in ASP.NET". Basically what you are doing is very similar, since you are "rewriting" a specific URL (the one to your old CSS file) to point to different content.

提交回复
热议问题