Don't miss out Virtual Happy Hour this Friday (April 26).

Try our conversational search powered by Generative AI!

Catalog routing issue, causing incorrect URL


I'm using the Sample store for EPiServer 7.5 as base for the website.

I have upgraded to the latest version through nuget.

I have added a seperate catalog along side with the standard in the sample proejct.

I  created an advertisement block

    [ContentType(DisplayName = "AdvertisementBlock", GUID = "e9eb4ae4-41df-4346-bf1d-1c319e99531e", Description = "Create an advert")]
    public class AdvertisementBlock : BlockData
        [Display(   Name="Image",
                    Description="Image to show in advert",
                    GroupName = SystemTabNames.Content,
        [UIHint( EPiServer.Web.UIHint.Image)]
        public virtual Url Image { get; set; }

        [Display(   Name = "Product Link",
                    Description = "Link to the product",
                    GroupName = SystemTabNames.Content,
                    Order = 10)]
        public virtual Url ProductLink { get; set; }

        [Display(   Name = "Description",
                    Description = "Short description",
                    GroupName = SystemTabNames.Content,
                    Order = 10)]
        public virtual string Description { get; set; }

And i created a control for this:

<a href="<%=CurrentBlock.ProductLink %>">
    <EPiServer:Property ID="ImagePoperty" PropertyName="Image" runat="server" />
    <EPiServer:Property ID="DescriptionProperty" PropertyName="Description" runat="server" />

with codebehind

    public partial class AdvertisementBlockControl : BlockControlBase<AdvertisementBlock>
        protected void Page_Load(object sender, EventArgs e)

For som reason the url created from product link is


The problem here is the underlined segement. if copy the link and remove that part the url works and i get to the correct category or product.

Where whould I direct my focus. Is it something in my routing that i've missed? I'm basically using the sample store out of the box, just changed the markup and rendering templates for metaclasses.

The other links on the site works as intended.

May 22, 2014 10:55


I don't see any code you assign value to ProductLink. Can you show it here?



May 22, 2014 11:52

I don't assign it from code, It's a url, that i assign when i create the block in edit mode. I get a catalog browser and i can choose a node and save the block.

May 22, 2014 12:51

Your block looks perfect Mikael, I have it work on my site. What CMS and Commerce versions do you have in your site? And have you injected any custom routing?

May 23, 2014 8:52

No, i'm using the standard from the sample site. Attached it below.

    public class InitializationModule : IConfigurableModule
        public void Initialize(InitializationEngine context)

            // Check the HostType is WebApplication
            if (context == null || context.HostType != HostType.WebApplication)


            // Init only in Web context type and first loading time of EPiServer Commerce Sample Site
            if (SettingFactory.Instance.Setting.IsSampleDataConfigured)

            // switch the flag
            SettingFactory.Instance.Setting.IsSampleDataConfigured = true;

        private static void MapRoutes(RouteCollection routes)
            CatalogRouteHelper.MapDefaultHierarchialRouter(routes, false);

        public void Preload(string[] parameters)

        public void Uninitialize(InitializationEngine context)

        public void ConfigureContainer(ServiceConfigurationContext context)
            context.Container.Configure(c => c.For<ICurrentMarket>().Singleton().Use<DinTidning.Commerce.Helpers.MarketStorage>());

        private void AddAssociationGroups(InitializationEngine context)
            // Add predefined selections CrossSell and UpSell
            // If they already exist nothing will be added
            var associationDefinitionRepository =
            associationDefinitionRepository.Add(new AssociationGroupDefinition { Name = Constants.CrossSellGroupName });
            associationDefinitionRepository.Add(new AssociationGroupDefinition { Name = Constants.UpSellGroupName });
May 23, 2014 8:58
  <package id="Castle.Core" version="3.2.2" targetFramework="net40" />
  <package id="Castle.Windsor" version="3.2.1" targetFramework="net40" />
  <package id="Common.Logging" version="1.2.0" targetFramework="net40" />
  <package id="Common.Logging.EntLib" version="1.2.0" targetFramework="net40" />
  <package id="Common.Logging.Log4Net" version="1.2.0" targetFramework="net40" />
  <package id="Common.Logging.NLog" version="1.2.0" targetFramework="net40" />
  <package id="DotNetZip" version="" targetFramework="net40" />
  <package id="EPiServer.CMS.Core" version="7.7.0" targetFramework="net40" />
  <package id="EPiServer.CMS.UI" version="7.8.0" targetFramework="net40" />
  <package id="EPiServer.CMS.UI.Core" version="7.8.0" targetFramework="net40" />
  <package id="EPiServer.Commerce" version="7.7.2" targetFramework="net40" />
  <package id="EPiServer.Commerce.Core" version="7.7.2" targetFramework="net40" />
  <package id="EPiServer.Commerce.UI" version="7.7.2" targetFramework="net40" />
  <package id="EPiServer.CommonFramework" version="7.5.446.2" targetFramework="net40" />
  <package id="EPiServer.Framework" version="7.7.0" targetFramework="net40" />
  <package id="log4net" version="1.2.10" targetFramework="net40" />
  <package id="Lucene.Net" version="3.0.3" targetFramework="net40" />
  <package id="Microsoft.AspNet.Mvc" version="4.0.30506.0" targetFramework="net40" />
  <package id="Microsoft.AspNet.Razor" version="2.0.30506.0" targetFramework="net40" />
  <package id="Microsoft.AspNet.WebPages" version="2.0.30506.0" targetFramework="net40" />
  <package id="Microsoft.Web.Infrastructure" version="" targetFramework="net40" />
  <package id="MicrosoftReportViewerWebForms_v10" version="1.0.0" targetFramework="net40" />
  <package id="Newtonsoft.Json" version="5.0.8" targetFramework="net40" />
  <package id="SharpZipLib" version="0.86.0" targetFramework="net40" />
  <package id="structuremap" version="" targetFramework="net40" />
May 23, 2014 9:38
* 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.