Search code examples
c#asp.netfriendly-urlenterprise-web-library

What do I have to do to get EWL Shortcut URLs to work?


I have this code:

protected override IEnumerable<ShortcutUrlResolver> GetShortcutUrlResolvers() {
    return new[]
        {
            new ShortcutUrlResolver( "someShortcut", ConnectionSecurity.SecureIfPossible, () => SmartRedirector.GetInfo( Pages.One.Two.GetInfo().GetUrl() ) ),
            new ShortcutUrlResolver( "", ConnectionSecurity.SecureIfPossible, () => Pages.Portals.GetInfo() )
        };
}

If I go to mysite/, I end up at the Portals page (the second shortcut above). If I go to mysite/someShortcut, I get a error:

this page is no longer available .

Solution

  • The problem was I wasn't trying to navigate to "mysite/someShortcut", I was trying to navigate to "mysite/someShortcut/", with a trailing slash. The slash counts. So, removing the slash from my URL makes it work. Also, I can include both "someShortcut/" and "someShortcut" as shortcut URLs and then either one will work.