zHaytam / SmartBreadcrumbs

A utility library for ASP.NET Core (both MVC and Razor Pages) websites to easily add and customize breadcrumbs.
https://blog.zhaytam.com/2018/06/24/asp-net-core-using-smartbreadcrumbs/
MIT License
161 stars 77 forks source link

Generated Links are wrong #98

Open mhkarami opened 2 years ago

mhkarami commented 2 years ago

I use razor page .net core 5 . and SmartBreadcrumb version 3.6.1 Generated Breadcrumbs titles are correct but link are wrong I named my pages as A , B , C ,... this is the Generated Breadcrumbs titles : BASE / A / B / C Links : Base : https://localhost:5001/ A : https://localhost:5001/Administration/A/B/C B : https://localhost:5001/Administration/A/B/C C : is not active page url in C Position is https://localhost:5001/Administration/A/B/C

Base class :

    [DefaultBreadcrumb("BASE")]
    public class IndexModel : PageModel

A Class (And Same for B And C just change names and change FromPage):

    [Breadcrumb("A")]  // test [Breadcrumb("A", FromPage = typeof(Pages.IndexModel))]
    public class IndexModel : PageModel

in version 3.4.0 and 3.1.1 i do not have this problem but still pages with input parameter does not work and have same problem for example if page be like :

    public class IndexModel : PageModel{
        public void OnGet(long kpiId)
        {

generated link is wrong

lapellaniz commented 2 years ago

@mhkarami Did you ever get passed this issue? I found this library and decided to try it but I am seeing the same error. The titles are correct but the links are all wrong. All previous links use the current page's link except the default one which is correct.

scott-724 commented 1 year ago

I am having this issue as well. The next to last breadcrumb is getting the link of the last breadcrumb entry.

savva-andreas commented 1 year ago

Hi, have the same issue because we use route values, e.g. @page "/page/{aRouteValue}". The fix for my scenario was in SmartBreadcrumbs\src\Nodes\RazorPageBreadcrumbNode.cs change public override string GetUrl(IUrlHelper urlHelper) => urlHelper.Page(Path, RouteValues); to public override string GetUrl(IUrlHelper urlHelper) => urlHelper.Page(Path, urlHelper.ActionContext.HttpContext.Request.RouteValues);

mhkarami commented 11 months ago

@lapellaniz I stopped using this library. after several years, I tempted to use this library again and the same error occurred to me again.