robbanp
I'm the co-founder of this website and the tech lead. Follow me on: twitter.com/robertpohl
Blog

The Rob blog

I'm Robert Pohl, the creator and co-founder to ThatsToday. I blog mostly about technology and internet related topics. Follow me on Twitter @robertpohl
Subscribe to RSS

When I implemented an anti-cache function for my website i discovered that ASP.NET somehow parses <link> tags and makes it impossible to add parameters to the url.

I pass an version number to the url so that I can force new loads of the js and CSS, like this:

 

    <script src="/script/portal.js?v=<%=ScriptVersion%>" type="text/javascript"></script>
    <link href="/css/portal.css?v=<%=ScriptVersion%>" rel="stylesheet" type="text/css" media="screen" /> <!-- does not work -->

 

Somehow ASP.NET parse the <link> tag and create this ugly code:

 

    <link href="/css/portal.css?v=&lt;%=ScriptVersion%&gt;" rel="stylesheet" type="text/css" media="screen" /> <!-- does not work -->

 

The only solution for this was to include CSS like this;

 

    <style type="text/css" media="screen">
         @import "/css/portal.css?v=<%=ScriptVersion%>";
    </style>

 

JavaScript includes works perfect, it's just the css links that is parsed :/

 

 

Comments on this article

Add your comment
Sign In

Not a member yet?

Signing up is FREE and will only take 15 seconds!

Facebook Login

Sign In

E-mail address:
Password:
Remember me
Sponsored links
AdUniver.se - ad platform Create wish-list e-böcker ljudböcker till din ipad android läsplatta dator

Close