Razor ViewEngine:如何避免“@”符号? [英] Razor ViewEngine: How do I escape the "@" symbol?
本文介绍了Razor ViewEngine:如何避免“@”符号?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我尝试使用< text>< / text>
,导致JIT错误。
解决方案
您必须使用@@才能转义@符号。
一个重要的事情要注意的是,当你的电子邮件地址存在时,你不需要转义@符号。剃刀应该足够聪明,可以自己弄清楚。
I'm trying to output some Twitter handles in ASP.NET MVC3 in conjunction with the Twitter @Anywhere API, and I haven't been able to figure out how to actually escape the "@" symbol in a Razor view.
Does anyone know what the syntax is for escaping the "@" character in Razor?
I've tried using <text></text>
and that results in a JIT error.
解决方案
You have to use @@ to escape the @ symbol.
One important thing to notice is that you DO NOT need to escape the @ symbol when it exists within an email address. Razor should be smart enough to figure that out on its own.
这篇关于Razor ViewEngine:如何避免“@”符号?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文