title: force browsers to get latest js and css files in asp.net application
body: <p>Some browsers cache js and css files, failing to refresh them unless you force them to.  What's the easiest way.</p>
  
  <p>I just implemented this solution that seems to work. </p>
  
  <p>Declare a version variable on your page</p>
  
  <pre><code>  public string version { get; set; }
  </code></pre>
  
  <p>Get the version number from web.config key</p>
  
  <pre><code> version = ConfigurationManager.AppSettings["versionNumber"];
  </code></pre>
  
  <p>In your aspx page make the calls to javascript and stylesheets like so</p>
  
  <pre><code>&lt;script src="scripts/myjavascript.js?v=&lt;%=version %&gt;" type="text/javascript"&gt;&lt;/script&gt;
  &lt;link href="styles/mystyle.css?v=&lt;%=version %&gt;" rel="stylesheet" type="text/css" /&gt;
  </code></pre>
  
  <p>So if you set the version = 1.1 from 1.0 in your web.config your browser will download the latest files which will hopefully save you and your users some frustration.</p>
  
  <p>Is there another solution that works better, or will this cause any unforeseen issues for a website?</p>