I am using ASP.Net Core 5 MVC Visual Studio 2019.
I am building a buildcrumb trail.
My Code is -
var breadcrumb = new HtmlContentBuilder()
.AppendHtml("<ol class='breadcrumb'><li>")
.AppendHtml(helper.ActionLink(ob.breadcrumbmap.YFVCList.Name.Titleize(),ob.breadcrumbmap.YFVCList.Action, ob.breadcrumbmap.YFVCList.Controller))
.AppendHtml("</li>"
if (controllerName.ToLower() != ob.breadcrumbmap.YFVCList.Controller.ToLower())
{
breadcrumb.AppendHtml("<li class='breadcrimb-item'>")
.AppendHtml(helper.ActionLink(ob.breadcrumbmap.YFVCList.YFVC.Name.Titleize(), System.Web.HttpUtility.UrlDecode(ob.breadcrumbmap.YFVCList.YFVC.Action + "/1"), ob.breadcrumbmap.YFVCList.YFVC.Controller))
.AppendHtml("</l>");
}
I get my info from a JSON file which I put into a object. -
string jsonData = File.ReadAllText("BreadcrumbMap.json");
Rootobject ob = JsonSerializer.Deserialize<Rootobject>(jsonData);
ob.breadcrumbmap.YFVCList.YFVC.Action
= "Clinic"
But I need to append an id on the end so I use + "/1" and UrlDecode the string.
System.Web.HttpUtility.UrlDecode(ob.breadcrumbmap.YFVCList.YFVC.Action + "/1")
However when I highlight the breadcrumb it shows -
/Clinic%2F1 instead of /Clinic/1.
I thought the decode would get rid of that?
Banging my head of the wall.