Suppose I have the following markup in a standard ASP.NET 2.0 web form:
<head runat="server">
<title>My Snazzy Page</title>
<link type="text/css" href="<%= PathUtilities.AssetPath %>/css/page.css" rel="stylesheet" />
<script type="text/javascript" src="<%=PathUtilities.AssetPath %>/lib/jquery/1.4.2/jquery.min.js"></script>
</head>
What's odd is that this renders the <link>
element literally, with the embedded code brackets, while it interpolates the output of the same code into the script tag. In other words, the browser sees this:
<head><title>My Snazzy Page
</title><link type="text/css" href="<%= PathUtilities.AssetPath %>/css/page.css" rel="stylesheet" />
<script type="text/javascript" src="/rmt/lib/jquery/1.4.2/jquery.min.js"></script>
</head>
Obviously the problem disappears if I remove the runat="server"
from the head element.