Creating a new provider is just implementing 1 method.

public override List<UrlRule> GetRules(int PortalId)

Tab Provider exemple (simplified) :

public override List<UrlRule> GetRules(int PortalId)
    List<UrlRule> Rules = new List<UrlRule>();
    TabController tc = new TabController();
    var tabs = tc.GetTabsByPortal(PortalId);
    foreach (TabInfo tab in tabs.Values)
            var rule = new UrlRule
                RuleType = UrlRuleType.Tab,
                CultureCode = tab.CultureCode,
                TabId = tab.TabID,
                Parameters = "tabid="+ tab.TabID.ToString(),
                Action = UrlRuleAction.Rewrite,
                Url = CleanupUrl(tab.TabName)
            TabInfo parentTab = tab;
            while (parentTab.ParentId != Null.NullInteger )
                parentTab = tc.GetTab(parentTab.ParentId);
                rule.Url = CleanupUrl(parentTab.TabName) + "/" + rule.Url;                        
    return Rules;

Look at the full version of the Tab Provider

Description of UrlRule fields

RuleType = Type of rule (Tab, Culture, Module)
CultureCode = Culture scope of rule
TabId = Tab scope
Parameters = internal parameters to rewrite
Action = Rule Action (rewrite or redirect)
Url = rewrite to this url (or redirect from for redirect rules)
RedirectDestination = Redirect location
RedirectStatus = 301, 302

Remark : For Rewrite rules, the RedirectDestination field can contain a url. This generate automaticaly a redirection from this url to the url field (automatic reverse redirection). If it is emply, a redirect rule is automaticaly generated from the parameters (for exemple aricleID=12 -> articleID/12)

Last edited Jun 10, 2013 at 1:43 PM by sachatrauwaen, version 8


No comments yet.