I have the following block of code that creates an Action Link for a company.
Html.ActionLink(Html.Encode(currentCompany.GetDisplayName()), "CompanyFactsheet", "Company",
new {friendlyURL = currentCompany.FriendlyURL.ToLower()}, null)%>
Some of the company names contain '&', and this is being rendered as &
Is there a way that I can Html.Encode
the company names, but still keep the &
symbol as it's supposed to look, rather than &
?
It seems like you don't need to encode when using ActionLink helper method. It encodes internally:
How do I bypass the HTML encoding when using Html.ActionLink in Mvc?