title: Automatically add version to js files inside asp.net header runat="server"
body: <p>I'm trying to reload reviewed css/js files automatically to prevent cache. I can loop trough header (which is runat="server") and add a value to link href references but the loop doesn't catch script tags as controls.</p>
  
  <pre><code>if (Page.Header != null)
  {
      foreach (var sc in Page.Header.Controls)
      {
          var type = sc.GetType();
  
          if (type == typeof(HtmlLink))
          {
              ((HtmlLink)sc).Href += "?v=" + Tools.BuildDate();
          }
          else if (type == typeof(HtmlGenericControl))
          {
              ((HtmlGenericControl)sc).Attributes["src"] += "?v=" + Tools.BuildDate();
          }
      }
  }
  </code></pre>
  
  <p>I've tried to add runat="server" to script tags but in this way asp.net tries to compile those files and build fails. I cannot add version every time because the project has many files. Also code blocks is not allowed when runat="server" is applied.</p>
  
  <p>I want to use a commonly accepted solution so I don't have to worry for css/js file versions any more.</p>