How do you escape a '@' symbol within in a url with razor

Sam picture Sam · May 28, 2014 · Viewed 7.6k times · Source

I know this is probably going to be something very simple and it is like just a 'gotcha' that I have yet to get; however, I have been struggling with escaping the @ symbol in the following URL.

<a href="https://www.google.co.uk/maps/place/XXXXXXXXXXXXXXXX/@55.000000,-1.000000,17z/data=!3m1!4b1!4m2!3m1!1s0x487e736c74d13649:0xe560f3b38693aec3">View on Google Maps</a>

I have already tried escaping it with a second @ i.e.

<a href="https://www.google.co.uk/maps/place/XXXXXXXXXXXXXXXX/@@55.000000,-1.000000,17z/data=!3m1!4b1!4m2!3m1!1s0x487e736c74d13649:0xe560f3b38693aec3">View on Google Maps</a>

Yet that produces the following YSOD

Parser Error Message: "55.00000" is not valid at the start of a code block.  Only identifiers, keywords, comments, "(" and "{" are valid. What am I missing?

Answer

pbjork picture pbjork · May 28, 2014

Try use &#64; instead of an actual @

<a href="https://www.google.co.uk/maps/place/XXXXXXXXXXXXXXXX/&#64;55.000000,-1.000000,17z/data=!3m1!4b1!4m2!3m1!1s0x487e736c74d13649:0xe560f3b38693aec3">View on Google Maps</a>