Reputation: 1
I use the label @ {var url = Html.Display ("URL"); } Click here But he turns me the & in & amp; and this invades the url.
How can I solve that?
@ {var url = Html.Display ("URL"); } Click here
Upvotes: 0
Views: 72
Reputation: 1322
Use encodeURIComponent()
which is the correct method to use
encodeURIComponent("URL")
Upvotes: 0
Reputation: 15569
When you say, Html.Display("URL")
, "URL" is a string and "URL" would be displayed. I assume what you want is Html.Display(URL)
where URL
is a variable containing your url.
Html.Display(myUrlVariable)
encodes your string to protect you against XSS attack.
If you don't want myUrlVariable
variable to be encoded, you can use HTML.Raw(myUrlVariable)
Upvotes: 1