Hi I have created a topNavigation class which implements PortalSiteMapProvider. the problem is that there is duplicated for the root site collection and root site collection contains only itself not other site collections. one of them goes to mydom/sitepages/startpage.aspx and the other one goes to mydom/. I would like to remove that one that goes to mydom/sitepages/startpage.aspx. here is my code: (not publishing sites)
public class RIRTopNavMapProvider : PortalSiteMapProvider
{
public override System.Web.SiteMapNodeCollection GetChildNodes(System.Web.SiteMapNode node)
{
SiteMapNodeCollection nodeColl = new SiteMapNodeCollection();
PortalSiteMapNode pNode = node as PortalSiteMapNode;
if (pNode != null)
{
if (pNode.Type == NodeTypes.Area && pNode.WebId == SPContext.Current.Site.RootWeb.ID)
{
SPWebApplication oWebApplicationCurrent = SPContext.Current.Site.WebApplication;
SPSiteCollection collSites = oWebApplicationCurrent.Sites;
foreach (SPSite site in collSites) //webApp.Sites)
{
try
{
if (site.RootWeb.DoesUserHavePermissions(SPBasePermissions.ViewPages))
{
AddNavNode(nodeColl, site.RootWeb.Title, site.RootWeb.Url);
break;
}
}
finally
{
if (site != null)
{
site.Dispose();
}
}
}
return nodeColl;
}
return base.GetChildNodes(pNode);
}
return new SiteMapNodeCollection();
}
private void AddNavNode(SiteMapNodeCollection nodeColl, string title, string url)
{
SiteMapNode navNode = new SiteMapNode(this, title, url, title);
nodeColl.Add(navNode);
}