Virtual Happy Hour this month, Jun 28, we'll be getting a sneak preview at our soon to launch SaaS CMS!

Try our conversational search powered by Generative AI!

Issue with UrlResolver.GetUrl



I have a problems with UrlResolver.GetUrl(ContentReference contentLink, string language). When i call this method from UI, I get correct url for item of menu. When i call this method from edit mode, i get url with element of url of edit mode for item of menu.

Version: Assembly EPiServer.dll, v7.6.5.0

Example(get url for item of menu):


var urlResolver = ServiceLocator.Current.GetInstance();

var url = urlResolver.GetUrl(contentReference, language);


Where contentReference={1073741825__CatalogContent} and language="sv".

When call this code from edit mode: url = "/episerver/CMS/Content/,,39810/catalog/verktyg-och-maskiner,,1073741825__CatalogContent/?epieditmode=True"

When call this code from UI: url = "/catalog/verktyg-och-maskiner/?overview=True"

Is it bug? Or do I do something wrong? Are any ideas? Please, help.

Best Regards,

Dzmitry Salauyou

Feb 13, 2015 11:18

I had a similar problem, ended up using @Url.ContentUrl(contentReference) instead (System.Web.Mvc.WebViewPage.Url). Made a wrapper for it for using in the controllers.


Edited, Feb 13, 2015 11:43

Mathias Kunto, Thank you.

But, this method doesn't work. I get the similar result, if i use urlResolver.GetUrl in edit mode.

Best Regards,

Dzmitry Salauyou

Feb 16, 2015 9:11

If I use
var url =urlResolver.GetUrl(contentReference, language, new VirtualPathArguments() {RouteValues = routeValueDictionary})

where routeValueDictionary = new RouteValueDictionary {{"overview", true}},

I get url = "/episerver/CMS/Content/,,39810/catalog/verktyg-och-maskiner,,1073741825__CatalogContent/?epieditmode=True&overview=True"

Are any ideas?

Best Regards,

Dzmitry Salauyou

Feb 16, 2015 10:16
* 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.