Exception Details:
{"A space or line break was encountered after the \"@\" character. Only valid identifiers, keywords, comments, \"(\" and \"{\" are valid at the start of a code block and they must occur immediately following \"@\" with no space in between."}
Hi in my mvc3 project, i have got an exception while i'm decoding the string value using
string s="(500500) Features: • 170 GPH @ 1 ft • Operates submersed.";
string DecodedValue = Server.HtmlDecode(Razor.Parse(s));
Here it doesn't encoding and exception was caught. How i got the decoded value.
You're attempting to parse the following string as a Razor template:
"(500500) Features: • 170 GPH @ 1 ft • Operates submersed."
In Razor, the @
character denotes that the following expression should be parsed as C#. If you want it to appear as a literal string, you need to escape it:
"(500500) Features: • 170 GPH @@ 1 ft • Operates submersed."
However, it's not clear why this needs to be parsed as Razor at all, since you are not passing any variable data. Why can't you simply use the following?
string s="(500500) Features: • 170 GPH @ 1 ft • Operates submersed.";
string DecodedValue = Server.HtmlDecode(s);