Escape @ character in razor view engine

后端 未结 15 1831
梦谈多话
梦谈多话 2020-11-22 07:55

I am creating a sample ASP.NET MVC 3 site using Razor as view engine. The razor syntax starts with @ character e.g. @RenderBody(). If I write @test

15条回答
  •  礼貌的吻别
    2020-11-22 08:31

    @@ is the escape character for @ in Razor views as stated above.

    Razor does however try to work out when an '@' is just an '@' and where it marks C# (or VB.Net) code. One of the main uses for this is to identify email addresses within a Razor view - it should not be necessary to escape the @ character in an email address.

提交回复
热议问题