开发者

Inline code tags are rendered as text under some circumstances

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="&lt;%= 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..

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜