I have an odd problem with MVC Razor @ escaping.
In some javascript in my view I have a line like this. The aim is to see if e is an email address containing a . before the @:
if (e.indexOf(".") < e.indexOf("@@")) { //Assume use firstname.lastname@... }
When testing locally, it renders correctly as:
if (e.indexOf(".") < e.indexOf("@")) { //Assume use firstname.lastname@... }
However on the server it renders as:
if (e.indexOf(".") < e.indexOf("@@")) { //Assume use firstname.lastname@... }
Which of course means it doesn’t work.
I deploy to the server via SVN, so all the files are identical apart from web.config.
What could be causing this? I’m using MVC 4.0.
Thanks.
You can sidestep the @ confusion if you use
\x40instead.