Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MVC 4 Bundle QueryString Version

I have MVC 4 project and I set Bundle config, then when run the project. Click Show Source on Google Chrome, I see,

Content/css?v=42vVIeLLwfJkSHVR7RjQehV5VVwDvOhprAczcjnTBiU1

Then I test my website performance on GTMetrix. And says me, Remove query strings from static resources for ?v=

How can i solve this problem?

like image 533
Güray Yarar Avatar asked Nov 11 '22 13:11

Güray Yarar


1 Answers

The v querystring is a dynamic cache buster, a hash of the file contents.

This is great for performance as you can cache the bundle for a year (default) and any changes to the contents will update the cache buster.

It's quite ironic that GTMetrix are reporting against this.

However if you really need to you can remove the hash cache-buster by setting false for the 2nd parameter of ResolveBundleUrl.

@BundleTable.Bundles.ResolveBundleUrl("~/Content/css", false)

If this is just to please GTMetrix however, I would refrain from doing this.

like image 109
Curtis Avatar answered Nov 15 '22 13:11

Curtis