Unsupported Feature Patch: External links handling

Jun 11, 2009 at 8:47 AM

Standard site-map providers are not able to handle external links but this can be handled when we are writing own custom site-map provider. It can be done i.e. in this way in AddNode method:

// DONE: HACK: handle external links
string url = node.Url ?? string.Empty;
if (url.StartsWith("http"))
{
node.Url = string.Empty;
}
else
{
url = null;
}
base.AddNode(node, parentNode); // original code
if (url != null)
{
node.Url = url;
}

But this will not still work when security trimming will be enabled. There must be change in DefaultMvcSiteMapAclModule.IsAccessibleToUser. Just replace line "return false;" with following line:
return (node.Url ?? string.Empty).StartsWith("http"); // DONE: HACK: external links

Aug 10, 2009 at 8:42 PM
Edited Aug 10, 2009 at 8:42 PM

When will this patch be included in the source code?

We wouldn't like to modify our code locally and get out of sync with the contributions.

We can contribute and modify this part if needed. We will use the MvcSiteMap in our next project and we have several external web pages and several web form pages.