protected virtual void AddNodeInternal(ISiteMapNode node, ISiteMapNode parentNode) { if (node == null) { throw new ArgumentNullException("node"); } lock (this.synclock) { bool urlPrepared = false; bool urlEncoded = false; string url = node.Url; if (!string.IsNullOrEmpty(url)) { if (node.HasAbsoluteUrl()) { // This is an external url, so we will encode it url = urlPath.UrlEncode(url); urlEncoded = true; } if (urlPath.AppDomainAppVirtualPath != null) { if (!urlPath.IsAbsolutePhysicalPath(url)) { url = urlPath.MakeVirtualPathAppAbsolute(urlPath.Combine(urlPath.AppDomainAppVirtualPath, url)); } if (this.urlTable.ContainsKey(url)) { if (urlEncoded) { url = urlPath.UrlDecode(url); } throw new InvalidOperationException(String.Format(Resources.Messages.MultipleNodesWithIdenticalUrl, url)); } } urlPrepared = true; } string key = node.Key; if (this.keyTable.ContainsKey(key)) { throw new InvalidOperationException(String.Format(Resources.Messages.MultipleNodesWithIdenticalKey, key)); } this.keyTable[key] = node; if (urlPrepared) { this.urlTable[url] = node; } if (parentNode != null) { this.parentNodeTable[node] = parentNode; if (!this.childNodeCollectionTable.ContainsKey(parentNode)) { this.childNodeCollectionTable[parentNode] = siteMapChildStateFactory.CreateLockableSiteMapNodeCollection(this); } this.childNodeCollectionTable[parentNode].Add(node); } } }