问题描述:

I'm running into an issue with a client-side script heavy web application where a new version of the application has been deployed, but due to caching between the Javascript bundles, Views and PartialViews one or more might pull from a cached version. This does result in pages breaking when it comes to model binding. There are many great questions and answers on StackOverflow regarding js versioning:

MVC bundle client caching

Web Essentials - Bundle versioning

force browsers to get latest js and css files in asp.net application

From what I've read it would seem that a Bundle is given a version number at runtime and subsequently that version number is embedded into the View when we render the Bundle into a View:

 @Scripts.Render("~/bundles/bundlename");

So by its very nature, a disconnect from a version of a View and the version of a Bundle being referenced should not happen?

If that is the case, is it a best practice then that Javascript that binds/references against HTML elements be rendered on the same View or PartialView that declares those elements ie. if the Bundle manipulates elements on a PartialView, then render that Bundle on the PartialView and not the parent View or vice versa?

相关阅读:
Top