TMC TMC - 3 months ago 39
ASP.NET (C#) Question

Why is the cache busting rule declared in web.config being ignored?

I'm trying to use the rewrite rule from the HTML 5 Boilerplate project to make circumventing browser cache (aka cache busting):

<rule name="Cachebusting">
<match url="^(.+)\.\d+(\.(js|css|png|jpg|gif)$)" />
<action type="Rewrite" url="{R:1}{R:2}" />
<rule name="Remove WWW" stopProcessing="true">
<match url="^(.*)$" />
<add input="{HTTP_HOST}" pattern="^(www\.)(.*)$" />
<action type="Redirect" url="{PATH_INFO}" redirectType="Permanent" />

If i try to access my css with
, it fails to find the file with the error reporting that it's looking for
(no rewrite). I've tried commenting out the
"Remove WWW"
rule to see if that was a conflict, but same behavior.

Any ideas why this rule isn't being applied and rewriting the URLs?

Update: I'm using these settings for my web server in VS2010:
enter image description here

<match url="^(.+)\.\d+\.(js|css|png|jpg|gif)$" />
<action type="Rewrite" url="{R:1}.{R:2}" />

I pressume you want to get /css/all.css, if not, post the desired result...

EDIT: VS internal development server (Cassini) doesn't support IIS URL Rewriting Module, you would have to use IIS (Express) for that, or some third party component (