Try our conversational search powered by Generative AI!

Episerver 10 UrlSegment have been replaced but how to use UrlCharacterMap?

Vote:
 

Hello,

I've updated my site to Episerver 10 and now I got an error at the line below:

if (!EPiServer.Web.UrlSegment.URLCharacterMap.ContainsKey('Š'))
   EPiServer.Web.UrlSegment.URLCharacterMap.Add('Š', 'S');


I know that the UrlSegment have been replaced with IUrlSegmentCreator/IUrlSegmentLocator/IUrlSegmentGenerator, but how can I replace above code to maken it work?

Hopefully someone can help me.

Kind regards,

Sander van de Pas

#183710
Oct 20, 2017 9:28
Vote:
 

You should set the character map on UrlSegmentOptions instead, see https://world.episerver.com/documentation/developer-guides/CMS/routing/internationalized-resource-identifiers-iris/

#183713
Oct 20, 2017 9:46
Vote:
 

Hi Johan,

Thanks for your answer.

I've tried to make it working on the UrlSegmentOptions, but till so far it doesn't work.

Could you have a look at the code below and see anything I'm doing wrong?

[ModuleDependency(typeof(EPiServer.Web.InitializationModule))]
public class IRIConfigurationModule : IConfigurableModule
{
public void ConfigureContainer(ServiceConfigurationContext context)
{
var options = new UrlSegmentOptions();
options.CharacterMap.Add('Š', 'S');

context.Services.AddSingleton<UrlSegmentOptions>(options);
}

public void Initialize(InitializationEngine context)
{ }

public void Uninitialize(InitializationEngine context)
{ }
}


Thanks in advance!

Grtz Sander

#184507
Oct 30, 2017 10:21
* 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.