how to display/render "@" symbol as string in mvc view as razor syntax uses the @ symbol to transition from HTML to C#?
Description:I am trying to write following code in my MVC View.
"@context" : "http://mywebsite.com",
"@type" : "WebSite"
but it is throwing error "The name 'context' does not exist in the current context" as it consider it as C# code.
Posted by: Samantha Jones | Posted on: Jun 27, 2019
1) by using double @@ in this case you can write your code as follows:
2)by using @Html.Raw method in this case you can write your code as follows:
3)By using @() to simply write string inside the brackets ,in this case your code will become as:
All the above three will do the trick for you.
Replied by: Peter Andre | Replied on: Jun 27, 2019