public UrlContentHandler(IRoutingAppService routingAppService) { OnUpdating <AutoroutePart>((ctx, part) => { _sourceUrl = part.DisplayAlias; }); OnUpdated <AutoroutePart>((ctx, part) => { if (string.IsNullOrEmpty(_sourceUrl) || string.IsNullOrEmpty(part.DisplayAlias)) { return; } if (_sourceUrl.TrimStart('/') == part.DisplayAlias.TrimStart('/')) { return; } routingAppService.Add(new RedirectRule { SourceUrl = _sourceUrl, DestinationUrl = part.DisplayAlias, IsPermanent = true }); }); }
public RedirectRuleController(IRoutingAppService routingAppService, IOrchardServices orchardServices, ISiteService siteService, IWebConfigService webConfigService) { _routingAppService = routingAppService; _orchardServices = orchardServices; _siteService = siteService; }
public RedirectFilter(IRoutingAppService routingAppService) { _routingAppService = routingAppService; }