Reputation: 13
I've a syntax error on my razor page when I use the following href
<a href="https://www.google.com/maps/place/2255+Honolulu+Ave+%231a,+Montrose,+CA+91020,+USA/@34.2055466,-118.2289469,17z/data=!3m1!4b1!4m5!3m4!1s0x80c2ea128474a255:0x54f73695881863c3!8m2!3d34.2055466!4d-118.2267582"></a>
In the link above there is USA/@34
part, which isn't recognized by the razor engine.
I've made research and it's suggested to use @@
to solve the problem.
But in my case the problem is /@
. When I write
USA@34
it's ok
USA/34
also is ok
but USA/@34
causes syntax error
How to solve the problem?
Upvotes: 1
Views: 147
Reputation: 14982
That's because @
is used to print the result of expressions on razor pages. Your solution will be to use \@@
in the url.
You can also do this:
@{
var url = "https://www.google.com/maps/place/2255+Honolulu+Ave+%231a,+Montrose,+CA+91020,+USA/@34.2055466,-118.2289469,17z/data=!3m1!4b1!4m5!3m4!1s0x80c2ea128474a255:0x54f73695881863c3!8m2!3d34.2055466!4d-118.2267582";
}
<a href="@url"></a>
Upvotes: 1