Handle breadcrumbs in mvc dotnetcore

I am working on a website (MVC dotnetcore) which also has many pages and threads. The user can approach one page in different ways. I get stuck when a user wants to go back and I don’t have a trace of his last URL. And I am embarrassed how to deal with this situation?

Should I use a global variable to track the last URL?

but in this case I have to do repeatable code on every screen or maybe for every get / post call.

OR

Should I use the breadcrumbs structure?

As if the user had moved Admin from Index, there would be something like this

 Index >> Admin 

And for further

 Index >> Admin >> ManageUsers 

And these will be links to their related pages. But I don't know how to handle this in mvc dotnetcore? Any idea

Which approach is good? Any help would be appreciated.

+3
source share
2 answers

I suggest you use breadcumb . Its bootstrap component, you can control it on the front panel. On the site map you need to do extra work. Compared to sitemap, breadcumb is simple, take a little effort and you can configure it as well breadcomb please visit the link above, it will help you fully.

0
source

You can refer to this article on how to implement a sitemap in an MVC project.

Basically you need to install the MvcSiteMapProvider package and add the following line to _Layout.cshtml :

 @Html.MvcSiteMap().SiteMapPath() 
-1
source

Source: https://habr.com/ru/post/1269492/


All Articles