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