Question

I using SiteMapPath with an xml file for data. I would like to use the same file for another menu, but I need to have more information attached to each node.

<siteMapNode target="_blank" url="~/Default.aspx" title="Home"  description="Home Page" >
VS
<siteMapNode url="~/Default.aspx" title="Home"  description="Home Page" >

So far it doesn't break on my box, but will I run into problems later? Or is there a better way?

Was it helpful?

Solution

Doubtfull you'll run into any problems. Whatever is consuming your sitemap file is only going to parse known attributes. Extra attributes will go ignored.

OTHER TIPS

Microsoft has always intended for siteMapNode elements to allow custom attributes on them. You can access the values of those attributes with the indexer on the SiteMapNode class.

The ASP.NET QuickStart Tutorials briefly mention this feature here.

I use this approach quite often and for quite some time. It has not caused me any problems. The only downside is the code needed to parse them.

I agree with the other answers. XML is meant to be eXtensible.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top