The Art of Programming

Put Code in Head Tags of HTML with Webforms

22. August 2013 07:29 by scott in   //  Tags:   //   Comments (0)

Working on a project and I have to put version numbers for CSS and Javascript files using the OLD webforms for ASP.NET.  Since I am working with such an old framework, I need to be creative.

Here is how to do it.

   1:    <head runat="server">
   2:  <asp:PlaceHolder runat="server">
   3:            <%=  @"<link rel='stylesheet' type='text/css'  href='/css/main.css?v=" + Web.Configuration.JS_VERSION + "' />" %>
   4:            <%=  @"<script type='text/javascript' src='/scripts/default.js?v=" + Web.Configuration.JS_VERSION + "'></script>" %>
   5:        </asp:PlaceHolder>
   6:  </head>