MvcSiteMapProvider icon indicating copy to clipboard operation
MvcSiteMapProvider copied to clipboard

Breadcrumb URL is generated without route parameters for HttpPost action

Open andrew-potachits opened this issue 8 years ago • 1 comments

Sitemap.xml (fragment):

  <mvcSiteMapNode title="Home" controller="Home" action="Index">
    <mvcSiteMapNode title="Projects" controller="Projects" action="Index">
      <mvcSiteMapNode title=" " controller="Projects" action="View" preservedRouteParameters="ProjectId">
        <mvcSiteMapNode title="Quote composition" controller="QuoteConfiguration" action="AddMoreSections" preservedRouteParameters="ProjectId,ProjectName"/>
        <mvcSiteMapNode title="Quote Generation" controller="QuoteGeneration" action="GenerateQuote" preservedRouteParameters="ProjectId,ProjectName" />
...

when I navigate to /QuoteConfiguration/AddMoreSections?ProjectId=1&QuoteId=2 (via HttpGet), the breadcrumb works fine: Project URL has ID:

/Projects/View?ProjectId=1

however when I navigate to: QuoteGeneration/GenerateQuote (HttpPost, ProjectId is in the post data), the ID in Project URL is missing: /Projects/View

my action methods look similar for post and get:

        [HttpPost, ValidateAntiForgeryToken]
        [SiteMapTitle("ProjectName", Target = AttributeTarget.ParentNode)]
        public ActionResult GenerateQuote(GenerateQuoteViewModel model)
...
        [SiteMapTitle("ProjectName", Target = AttributeTarget.ParentNode)]
        public async Task<ActionResult> AddMoreSections(int projectId, int quoteId, string returnUrl)
...

andrew-potachits avatar Nov 11 '15 11:11 andrew-potachits

In its current incarnation, preserved route parameters first tries to get the value from route values, then from the query string. The form collection is not part of the equation.

But then, this does seem like a good idea so I will consider this a feature request.

NightOwl888 avatar Nov 11 '15 20:11 NightOwl888