My asp.net view displays a client's name at the top of every page using a layout template. This works fine except when the name property is assigned a value that contains an apostrophe. The view displays the ascii code for the apostrophe instead of an actual apostrophe. For example:
if the client's name is set to "Client's Name", the view renders the name as "Client's Name"
instead of "Client's Name"
Layout Template code:
@helper ClientName()
{
if (Session["CurrentClient"] != null)
{
@(((ClientModel)Session["CurrentClient"]).Name);
}
else
{
@String.Format("{0}", "None");
}
}
@Html.ActionLink("Client[" + @ClientName().ToString() + "]", "Index", "Home", null, new { @class = "navbar-brand" })
What do I do to convert the string value to HTML so the apostrophe is shown?