问题
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=<%=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=<%: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