using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Configuration;
using EPiServer.Framework;
using EPiServer.Framework.Initialization;
using EPiServer.ServiceLocation;
using EPiServer.Web;
namespace AlloyImageVault1600.Business.Initialization
{
[InitializableModule]
[ModuleDependency(typeof(EPiServer.Web.InitializationModule))]
public class UrlSegmentConfigurationModule : IConfigurableModule
{
public void ConfigureContainer(ServiceConfigurationContext context)
{
/* Internationalized Resource Identifiers (IRIs)
When creating Url segments (name in URL or simple address), by default, Episerver only allows characters according to RFC 1738, which basically allows ALPHA / DIGIT / '-'/ '_'/ '~' / '.'/ '$'/.
*/
// define a custom character set, e.g.: Space, 漢
// sample setting:
var validChars = ConfigurationManager.AppSettings["ValidUrlChars"];
if (validChars == null) validChars = "";
context.Services.RemoveAll();
context.Services.AddSingleton(s => new UrlSegmentOptions
{
SupportIriCharacters = true,
ValidCharacters = @"\p{L}0-9\-_~\.\$" + validChars
});
}
public void Initialize(InitializationEngine context)
{
//Add initialization logic, this method is called once after CMS has been initialized
}
public void Uninitialize(InitializationEngine context)
{
//Add uninitialization logic
}
}
}