在ASP.NET MVC故障打印meta标签 [英] Trouble print meta tags with ASP.NET MVC
本文介绍了在ASP.NET MVC故障打印meta标签的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想根据我的模型数据,使meta标签在我看来......我的看法code是这样的:
I'm trying to make a meta tag in my view based on data in my model...my view code looks like this:
<meta name="description" content="<%=Html.Encode(Model.MetaDescription) %>" />
但我的输出是这样的:
But my output looks like this:
meta name="description" content="<%=Html.Encode(Model.MetaDescription) %>" />
什么鬼我做错了?
What the heck am I doing wrong?
推荐答案
您可能正在添加此元
标记到&LT; HEAD&GT;
其标在 =服务器标签
。尝试:
You are probably adding this meta
tag to a <head>
tag which is marked at runat="server"
. Try:
<meta name="description" content='<%=Html.Encode(Model.MetaDescription) %>' />
我没有对实际的问题是什么明确的想法,因为我没有完整的源代码,但解决方法:
I don't have a clear idea about what the actual problem is, as I don't have the full source, but to workaround:
<meta name="description" content=<%= "\"" + Html.Encode(Model.MetaDescription) + "\"" %> />
这篇关于在ASP.NET MVC故障打印meta标签的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文