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!

UrlResolver.GetUrl always returns host name url



For some reason, this line of code is always returning the host name url instead of the CMS page url. However, it does work for commerce data. This code is executed in a scheduled job.

url = this.UrlResolver.GetUrl(content.ContentLink, language);

Any ideas how to solve this?

Kind regards


Aug 06, 2019 16:25

Are you sure you have correct domains setup that match where you're browsing from and everything is published? This can happen if you've not, you'll also see that in the CMS the URl when you however over globe in the header is also empty

Aug 06, 2019 17:56

Hi Bart,

When you say that GetUrl is returning the hostname url rather than the CMS page URL, do you mean that it's returning http://mysite.tld/mypage/ rather than just /mypage/ or /en/mypage/?

I suspect this issue will be related to the host name setup on your site. GetUrl takes the context in which it's run into account so, if you've got a host set up for with the language en and with the language fr and you call GetUrl with an FR page reference from within the EN site, it will return you the full URL including the host. If you make that same call from within the FR site you'd get the URL without the host. This is for good reason in that the path "/", for example, will return different pages depending on which domain you append it to.

Is it an issue that you get the domain returned in the URL?

Aug 06, 2019 18:16


Currently I've set up 2 host names:

  • localhost:51481

They both have no culture set.

The problem occurs when I run a scheduled job to create an XML sitemap (I'm using Geta.SEO.Sitemaps). The GetUrl method is always returning and not the full URL. Maybe this is because it's a scheduled job and there's no HTTP context?

So it's not an issue that the domain is included in the URL but I need the full URL and not only the domain part. 

Aug 07, 2019 9:03

We use the Geta sitemap and it creates the sitemap okay but you have to in the configuration add the hostname you're generating and it needs to map to your domain in the site configuration. If you post the screenshot of your geta configuration and the site configuration I'll check it over.

Aug 07, 2019 9:47

Unfortunately, I'm not allowed to upload images with my account here so check this:

Thanks a lot!

Aug 07, 2019 9:56

You should be able to just drag and drop in to the rich text editor here. Can you post your sites configuration as well please.

Aug 07, 2019 10:01

I'm not allowed to upload images because I'm not working for a EPiServer partner company. I'm not even allowed to embed hyperlinks that's why you have to copy paste my URL's :/

Here's my site configuration:

Aug 07, 2019 10:05

Ah I didn't realize there was that restriction. I've not used the plugin with multi language before so not 100% sure on this one, I'll message Valdis who works at Geta he might have some ideas.

Aug 07, 2019 10:12

Thanks Scott!

I managed to solve it on my own. It turned out we were using an older version of the Geta.SEO.Sitemaps package. And instead of adding it as a NuGet package, we had a copy of the source code in our solution because we had to create a custom ContentFilter and there was no way to override it.

This code line was missing in the SitemapXmlGenerator class and I think that caused the error:

SiteDefinition.Current = SiteSettings;

Anyway, in the latest version of the Geta package, there's an interface IContentFilter so now I added the latest version via NuGet (as it should be instead of having a copy) and created a custom implementation of IContentFilter.

Aug 07, 2019 14:10

Ahh that makes sense, I've had that happen before. Glad you got it sorted

Aug 07, 2019 14:12

glad Bart, you solved the issue. if you have any further concerns or limitations using Geta.Sitemap package, feel free to file us an issue on GitHub. thx

Aug 12, 2019 23:50
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.