How to get correct route url in dojo component?


Dear EPIServer Team,

please help.

I want to get the partial view in dojo component. The issue is with the request url.

When i try to use(DynamicImages is a controller and Images as an action)

$.post("DynamicImages/Images", { json: jsonData }, function (value) {

var fieldContainer = $('.imagesContainer');

the request is sent to incorrect url: http://localhost:83/DynamicImages/Images,

not to http://localhost:83/MySite/DynamicImages/Images.

I found epi.routes.getActionPath, but how to use these method to get the correct url?

How to setup parameters?

 var url = ({
                    moduleArea: "CMS", // ????
                    controller: "DynamicImages",
                    action: "Images",                   

The result is  /MySite/EPiServer/CMS/DynamicImages/Images

but I need  /MySite/DynamicImages/Images

What should I use to generate correct url to the action?

Thank you inadvance.

Oct 08, 2013 18:53

The route configuration for the epi/routes helper is generated from the module.config settings. You can probably achieve what you want by adding the following the module.config in the site.

<module routeBasePath="~/">
    <route url="{controller}/{action}/{id}" />

and the getting the route path using

    moduleArea: "App", 
    controller: DynamicImages",
    action: "Images"



Oct 09, 2013 9:23

Thank you very much for the aswer. It helped.

But if I use the parameter moduleArea: "App" , I get the url "MySite/DynamicImages/Images?moduleArea=App"

How to setup the route without the moduleArea = App ?

How to get the list of the available moduleArea?

Please, help.

 P.S. I used the epi.routes.getActionPath({controller: "DynamicImages",action: "Images"}, "{controller}/{action}"), returned the "DynamicImages/Images"

but how to return clear "MySite/DynamicImages/Images"?

Edited, Oct 10, 2013 18:35

Hmm, the getActionPath helper is primarily intended for resolving routes to the different modules, and therefore the module area is always a part of the route. And since the logic in the helper is quite simple, all parameters that can't be substituted in the path will be appended as query parameters.

For the available areas you can look at 

Oct 14, 2013 9:27
This thread is locked and should be used for reference only. Please use the Episerver CMS 7 and earlier versions forum to open new discussions.
* 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.