November Happy Hour will be moved to Thursday December 5th.

URL parameters stripped from links in Edit Mode

Vote:
 

When adding a link containing a query parameter to an internal page in html view in the editor, on save the url is converted so that it breaks the correct link. Example:

href set to: "/collection/search?id=321"

on save href becomes: "/EPiServer/CMS/Content/collection/search,,963/?epieditmode=False"

in published page view href is: "/collection/search" 

How do I retain the url parameter? I need the parameter to load a result from a large json file.

Thanks for any ideas / potential work arounds.

#142599
Dec 15, 2015 20:47
Vote:
 

Solved this by override in Global.asax.cs on Register Routes. 

href in edit mode: "/collection/search/321"

Global:

protected override void RegisterRoutes(RouteCollection routes)
        {
            base.RegisterRoutes(routes);


            routes.MapRoute("collection/search/",
                            "collection/search/{*path}",
                            new { controller = "Redirect", action = "Index", path = UrlParameter.Optional });

        }

In my RedirectController I redirect to my search page path including the id parameter I need for my search.

#142600
Dec 15, 2015 21:12
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* 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.