Ejemplo n.º 1
0
        public override void Initialize(string name, NameValueCollection attributes)
        {
            if (_initialized)
            {
                throw new InvalidOperationException(
                          SR.GetString(SR.XmlSiteMapProvider_Cannot_Be_Inited_Twice));
            }

            if (attributes != null)
            {
                if (string.IsNullOrEmpty(attributes["description"]))
                {
                    attributes.Remove("description");
                    attributes.Add("description", SR.GetString(SR.XmlSiteMapProvider_Description));
                }

                string siteMapFile = null;
                ProviderUtil.GetAndRemoveStringAttribute(attributes, _siteMapFileAttribute, name, ref siteMapFile);
                _virtualPath = VirtualPath.CreateAllowNull(siteMapFile);
            }

            base.Initialize(name, attributes);

            if (attributes != null)
            {
                ProviderUtil.CheckUnrecognizedAttributes(attributes, name);
            }

            _initialized = true;
        }