Exemplo n.º 1
0
        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
                });
            });
        }
Exemplo n.º 2
0
 public RedirectRuleController(IRoutingAppService routingAppService, IOrchardServices orchardServices, ISiteService siteService, IWebConfigService webConfigService)
 {
     _routingAppService = routingAppService;
     _orchardServices   = orchardServices;
     _siteService       = siteService;
 }
Exemplo n.º 3
0
 public RedirectFilter(IRoutingAppService routingAppService)
 {
     _routingAppService = routingAppService;
 }