0

Just started on ASP.NET MVC and I noticed a strange behaviour on updating a javascipt.

_AppLayout.cshtml

    <script src="@Url.Content("~/Content/bower_components/jquery/dist/jquery.js")"></script>
    <script src="@Url.Content("~/Content/bower_components/bootstrap/dist/js/bootstrap.js")"></script>
    <script src="@Url.Content("~/Content/bower_components/jquery-ui/jquery-ui.js")"></script>
    <script src="@Url.Content("~/Content/scripts/app.js")"></script>

The @Url.Content is working, but when I modify the app.js the modification will only apply when I replace the script src=... line. Why is that? Has ASP.NET some kind of cache? Which way will load the file without the modifications?

Edit Is it necessary to use bundles so the changes will apply? Regards

Leonel Sanches da Silva
  • 6,972
  • 9
  • 46
  • 66
Jim Vercoelen
  • 1,048
  • 2
  • 14
  • 40
  • 1
    Browser cache...Bundling will help with the task of 'cache-busting'. – David Tansey Dec 01 '15 at 17:59
  • @DavidTansey thanks for response! Is this the only way to fix this cache? Because it's really ignoring while developing some javascript!:o – Jim Vercoelen Dec 01 '15 at 18:02
  • OMG, really embarrassing but I just figured out that a simple refresh does the job... – Jim Vercoelen Dec 01 '15 at 18:04
  • 2
    During development you should be able to use CTRL-F5 or similar to refresh the cached items. https://www.getfilecloud.com/blog/2015/03/tech-tip-how-to-do-hard-refresh-in-browsers/#.Vl3hN1WrTRY – David Tansey Dec 01 '15 at 18:05
  • 1
    It also helps to [disable the browser cache during development](http://stackoverflow.com/questions/33047794/how-do-i-ensure-my-script-file-isnt-cached-when-debugging-a-vs-mvc-website/33048502#33048502). – Jasen Dec 01 '15 at 19:29
  • Thanks for your response all, definitely usefull – Jim Vercoelen Dec 01 '15 at 20:08

0 Answers0