Support url attribute in mvcSiteMapNode

Sep 22, 2009 at 5:55 AM

If you have an external URL or Webform url in your sitemap, you have to use a <siteMapNode>

Was thinking that <mvcSiteMapNode> could support the url attribute - if it finds it, you know to treat it as a normal url.

This would let me use the new visibility attribute and any other applicable features of a mvcSiteMapNode.


Sep 22, 2009 at 6:20 AM

Not sure what all is required to make the above happen.  But I a simple modifications and it seems to work.

MvcSiteMapProvider.cs, GetMvcSiteMapNodeFromXMLElement anywhere around like 830 where setting properties from the siteMapNode:

            if (siteMapNode["url"] != null)
                siteMapNode.Url = siteMapNode["url"];

Then to IMvcSiteMapNodeAttribute.cs interface, add another property:

string Url { get; set; }

Finally in MvcSiteMapNodeAttribute.cs implementation, add implement the interface with:

public string Url { get; set; }

That is already had other code in place to return the url if it was not null, so the above just loads it from the .sitemap and then provides the mapping.

If this is all ok, maybe you could put in the official code?


Sep 23, 2009 at 7:01 AM
This discussion has been copied to a work item. Click here to go to the work item and continue the discussion.