I have a HTML like this:
<img src="..." alt="Find me on twitter as @username" />
However, that gives an error that variable “username” does not exist. Outside of HTML attributes, at-sign can be escaped as @@ but that doesn’t work inside attributes. What’s the right syntax?
In MVC3 (e.g Razor 1.0) the double at e.g
@@is working:But in MVC4 (e.g Razor 2.0) something has changed and it’s not working anymore (maybe it’s a bug…).
So because it’s only allowed to have a code block inside an attribute you need to write a code block with
@(...)from where you can return the@:or
As far as I know Web Pages 2.0 uses Razor 2.0.