This is a really strange one. I am trying to add a cache value to my css stylesheet references in order to invalidate the http header caching I have set. I have the following code:
<link href="/css/Continuity2/layout.css?cache=<%=Global.CACHE_KEY %>" rel="stylesheet" type="text/css" />
The above is rendered as follows and does not seem to be picking up the inline code:
<link href="/css/Continuity2/layout.css?cache=<%=Global.CACHE_KEY %>" rel="stylesheet" type="text/css" />
The even stranger thing is, I have the following code for my javascript references:
<script type="text/javascript" src="/js/ajaxhelper.js?cache=<%=Global.CACHE_KEY %>"></script>
And this references as expected:
<script type="text/javascript" src="/js/ajaxhelper.js?cache=70BE31E0-E694-45ff-A920-D6564DA2FB79"></script>
Has anyone any idea why on earth this would happen?
<link>tags inside a<head>tag are converted intoHtmlLinkobjects.You can resolve the issue either by setting the property value programmatically from your code behind, or by using a control adapter.
It would probably also work if you moved the tag outside of your head section, although that can have an effect on the way your page is rendered (potential flashes, etc after the CSS is loaded).
I should also add that using a query string on static files to force versioning is usually not an ideal solution, because it prevents the high performance kernel mode HTTP driver (http.sys) from caching the file.