剃刀视图引擎:我如何逃脱" @"符号? [英] Razor ViewEngine: How do I escape the "@" symbol?

查看:176
本文介绍了剃刀视图引擎:我如何逃脱" @"符号?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想输出一些Twitter的处理在ASP.NET MVC3与Twitter的API @Anywhere结合,我一直无法弄清楚如何逃生竟在剃刀视图中的@符号。

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?

我试过使用<文本>< /文本方式> 并导致一个JIT误差

I've tried using <text></text> and that results in a JIT error.

推荐答案

您必须使用@@逃脱@符号。

You have to use @@ to escape the @ symbol.

下面是一个<一个href=\"http://dotnetslackers.com/articles/aspnet/Experience-ASP-NET-MVC-3-Beta-the-Razor-View-Engine.aspx#s14-differentiate-the-symbol--intelligently\">excellent关于如何使用@符号的文章可以在剃刀语法内使用。要注意一个重要的事情是,你不需要在一个电子邮件地址中存在逃跑的@符号。剃刀应该足够聪明去弄清楚自身。

Here is an excellent article on how to use the @ symbol can be used within the Razor syntax. 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.

这篇关于剃刀视图引擎:我如何逃脱&QUOT; @&QUOT;符号?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆