SiteMap nodes and identical urls
<siteMap xmlns="http://schemas.microsoft.com/AspNet/SiteMap-File-1.0" >
<siteMapNode>
<siteMapNode url="~/Employee/Home.aspx" title="Employee Home">
<siteMapNode url="~/Common/Records.aspx" title="Records"/>
<siteMapNode url="~/Employee/Profile.aspx" title="Profile" />
</siteMapNode>
<siteMapNode url="~/Admin/Home.aspx" title="Admin Home">
<siteMapNode url="~/Common/Records.aspx" title="Records"/>
<siteMapNode url="~/Admin/Profile.aspx" title="Profile" />
</siteMapNode>
</siteMapNode>
</siteMap>
will fail with the following error
Multiple nodes with the same URL '/Navigation/Common/Records.aspx' were found. XmlSiteMapProvider requires that sitemap nodes have unique URLs.
The simple workaround I came up with is to move all the contents of Records.aspx to a UserControl and have two aspx pages with unique names load this UserControl. So my sitemap file becomes:
…
<siteMapNode url="~/Common/EmployeeRecords.aspx" title="Records"/>
…
<siteMapNode url="~/Common/AdminRecords.aspx" title="Records"/>
…
ScottGu suggests that another (maybe easier) way to-do it is to have one of the .aspx files have a querystring attribute to it in the sitemap (for example: Records.aspx?param=1). The site navigation system allows you to differentiate using querystrings and will allow this.
A different approach as suggested by Danny Chen is that if you wanted to, since there is no requirement on the actual SiteMapProvider, you could write your own custom provider or possibly inherit from the XmlSiteMapProvider and override key functions (like AddNode, FindSiteMapNode) to get the behavior you're looking for.