In my aspx I have t开发者_开发问答his line:
<link href="<%= Request.ApplicationPath %>/css/ma/screen-ma.css" rel="Stylesheet"type="text/css" media="screen" />
which renders as:
<link href="/XFormPortal/css/ma/screen-ma.css" rel="Stylesheet"type="text/css" media="screen" />
That seems correct, right?
Then i change a single character, lets say add a space between the rel and the type attribute, so now I have the following:
<link href="<%= Request.ApplicationPath %>/css/ma/screen-ma.css" rel="Stylesheet" type="text/css" media="screen" />
Which now rendes as:
<link href="<%= Request.ApplicationPath %>/css/ma/screen-ma.css" rel="Stylesheet" type="text/css" media="screen" />
Okay, what just happend here? The inline code tag is suddenly ignored and written out as text? Because of a single space?
Can anyone explain this?
I would suggest it has something to do with the order in which expressions are parsed by the precompiler... specifically, I suspect that the omission of the space in your first example causes a particular regular expression match to fail, and you essentially escape correct parsing. Use single quotes around your href tag instead.
<link href=<%="\""+Request.ApplicationPath%>/css" rel="Stylesheet" type="text/css" media="screen"/>
Try to remove the runat="server" from the head tag..
精彩评论