Razor view engine automatically applying quotes?

前端 未结 3 1290
借酒劲吻你
借酒劲吻你 2021-01-03 19:07

I\'m fairly used to razor now, but I can\'t understand why the following syntax is correct?

  • @Html.ActionLin
  • 3条回答
    •  梦毁少年i
      2021-01-03 19:32

      Razor automatically HTML-escapes all code output.
      You can prevent this by writing @Html.Raw(...)

      Alternatively, you can put the quotes in the literal text:

    • Your example works because you don't actually have any quotes.
      The generated HTML source reads

    • .

    提交回复
    热议问题