Try our conversational search powered by Generative AI!

Tips for implementing GetPartialVirtualPath() with "multi-level" partial routing

Vote:
 

Hi!

In our solution we have the following scenario:

/page-in-episerver-1/{city}-{address}-{id1}-{id2}

/page-in-episerver-1/{city}-{address}-{id1}-{id2}/page-in-episerver-2

Page-in-episerver-1 has a different pagetype than page-in-episerver-2.

We implemented routing for these pages (page-in-episerver-1 + page-in-episerver-2) using these articles:

http://world.episerver.com/blogs/Johan-Bjornfot/Dates1/2012/11/Partial-Routing/

http://joelabrahamsson.com/custom-routing-for-episerver-content/

When we want to post forms on the "page-in-episerver-2", we have the followng form-tag:

@using (Html.BeginForm("Index", "page-in-episerver-2", FormMethod.Post))


This result in an incorrect submit-url, because we did not implement the GetPartialVirtualPath() method in the partial router for page-in-episerver-2.

Do you have any tips on how to implement the GetPartialVirtualPath() method for the routing for page-in-episerver-2, when page-in-episerver-2 only exists below /page-in-episerver-1/{city}-{address}-{id1}-{id2}/ ?

How do I obtain the {city}-{address}-{id1}-{id2} part when I am calling GetPartialVirtualPath() from a handler (i.e. does not have the same requestcontext as when I enter the page) ?

Best regards

Jesper

#119065
Mar 20, 2015 8:33
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.