I can append a token to my script references like this:
<script type="text/javascript" src="/Some.js?<%= Html.GetToken() %>"></script>
… and this works fine. But, if I try to append the same token the same way to a CSS file reference:
<link rel="stylesheet" type="text/css" href="/Some.css?<%= Html.GetToken() %>" />
… the IIS generates the following markup:
<link rel="stylesheet" type="text/css" href="/Some.css?<%= Html.GetToken() %>" />
I know I’m missing something super simple but I cannot see what exactly. Thanks in advance for any help!
This happens if your
<head>section hasrunat="server". If you can live without it (in ASP.NET MVC you usually can) try it this way.If not, add or modify the CSS link in your view’s
Page_Load. If that sounds awful to you, then removingrunat="server"should be working 🙂