2

I'm having trouble with caching on my website. I have static files that should usually be cached for weeks or months, but need to be updated right away for users if I make changes to the files. To get around this, I thought of having something like:

<script src="js/masterPage.js?v=$$Number$$" type="text/javascript"></script>

Then, I need a script to change $$Number$$ into a number. It doesn't really matter what the number is, so long as it is different every time.

I could write a script to go through my do this kind of processing, but if there is some way to do this automatically when I hit "Publish" in visual studio it would be really handy. What possibilities are there?

Oliver
  • 11,297
  • 18
  • 71
  • 121

1 Answers1

2

You don't need to do that. You can let IIS handle it for you by sending 304 HTTP responses until your files are modified. I answered a similar question like this here. Take a look.

Community
  • 1
  • 1
Icarus
  • 63,293
  • 14
  • 100
  • 115