Escape @ character in razor view engine

后端 未结 15 1828
梦谈多话
梦谈多话 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:49

    You can use @@ for this purpose. Like var email = firstName + '\@@' + domain;

    0 讨论(0)
  • 2020-11-22 08:50

    this work for me

    <meta name="author" content="Alan van Buuren @("@Alan_van_Buuren")">
    

    Or yoy can use: @@Alan_van_Buuren

    :D

    0 讨论(0)
  • 2020-11-22 08:53

    Instead of HTML entity I prefer the use of @Html.Raw("@").

    0 讨论(0)
提交回复
热议问题