Hi, Neil,
I'd suggest taking an easier approach if that's possible for you.
You'd create a new page type called LateAvailabilityPage and then create it under SearchPage with any name you want. Then you do what you'd want to do in LateAvailability action, in Index action of the new page.
Not sure if this suits your requirements, but is way easier and more "CMS way".
BR,
Marija
I suggest going with Marijas way...it's also possible to extend the common routing by registrating new routes and using EPiServers routing and routed events like this:
protected override void RegisterRoutes(System.Web.Routing.RouteCollection routes)
{
base.RegisterRoutes(routes);
EPiServer.Web.Routing.ContentRoute.RoutingContent+=ContentRoute_RoutingContent;
}
void ContentRoute_RoutingContent(object sender, RoutingEventArgs e)
{
if (e.RoutingSegmentContext.RemainingPath == "Test-Action")
{
e.RoutingSegmentContext.RemainingPath = "TestAction";
}
}
Many thanks for the replies.
I think I'll take Marija's advice and break the tabs into separate pages.
I did find a solution however based upon another forum post - I applied a ExistingActionRouteConstraintWrapper around the exisiting ExistingActionRouteConstraints in the route table and if a Match failed, replaced "-" in the action name and retried the Match with the original ExistingActionRouteConstraint.
public class ExistingActionRouteConstraintWrapper : IContentRouteConstraint { private readonly ExistingActionRouteConstraint _original; public ExistingActionRouteConstraintWrapper(ExistingActionRouteConstraint original) { this._original = original; } public bool Match(Route route, SegmentContext segmentContext, string parameterName) { // If orignal cant be match, if (!_original.Match(route, segmentContext, parameterName)) { var action = segmentContext.RouteData.Values[parameterName] as string ?? string.Empty; segmentContext.RouteData.Values[parameterName] = action.Replace("-", string.Empty); } var result = _original.Match(route, segmentContext, parameterName); // Try again (with possible action modified) return result; } }
Cheers
Hi,
Is there anyway to map the {action} part of Url onto a different action name?
So I want to map the Url /site-search/late-availability on to an action called LateAvailability in my page controller?
Right now it seems that only /site-search/lateavailability works and I've tried decorating my actions with ActionName and Route attributes but neither work.
Cheers