Пример #1
0
        public override SiteMapNode FindSiteMapNode(string rawUrl)
        {
            XElement currNode = null;
            var      id       = Guid.Empty;

            if (rawUrl.IndexOf('?') > -1)
            {
                Guid.TryParse(WebCommon.GetQueryStringByKey(rawUrl, "Id"), out id);
            }
            if (!id.Equals(Guid.Empty))
            {
                currNode = root.Descendants().First(x => x.Attribute("Id").Value == id.ToString());
            }
            else
            {
                currNode = root.Descendants().First(x => x.Attribute("Url").Value.ToLower().Contains(rawUrl.ToLower()));
            }

            return(new SiteMapNode(this,
                                   currNode.Attribute("Id").Value,
                                   currNode.Attribute("Url").Value,
                                   currNode.Attribute("Title").Value,
                                   currNode.Attribute("Description").Value));
        }