Inline tag not executing in an asp.net master page

断了今生、忘了曾经 提交于 2019-12-31 01:44:08

问题


This really should be so very simple...

I have an asp.net master page which is working as expected. It includes some asp: tags without any problems.

The master page also includes the line

<link rel="stylesheet" type="text/css" href="css/main.css?v=<%=variableName%>" />

which is not executing. The output HTML has this as

<link rel="stylesheet" type="text/css" href="css/main.css?v=&lt;%=variableName%>" />

I do not work in asp.net very much so hopefully I have missed something super simple. Any suggesions on how to stop my inline asp tags from being HTML-encoded?

Many thanks.

EDIT

So it just gets sillier

This works: href="css/main.css?v=<%:"variableName"%>" and outputs href="css/main.css?v=variableName"

However this doesn't: href="css/main.css?v=<%:variableName%>" and outputs href="css/main.css?v=&lt;%:variableName%>"

Seriously I never thought I would say it but PHP makes WAYYY more sense!


回答1:


Try this one

UPDATE: <link rel="stylesheet" type="text/css" href=<%="'css/main.css?v="+"34'"%> />



来源:https://stackoverflow.com/questions/8439685/inline-tag-not-executing-in-an-asp-net-master-page

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!