System.Web.XmlSiteMapProvider.Initialize C# (CSharp) Method

Initialize() public method

public Initialize ( string name, NameValueCollection attributes ) : void
name string
attributes NameValueCollection
return void
		public override void Initialize (string name, NameValueCollection attributes)
		{
			if (initialized)
				throw new InvalidOperationException ("XmlSiteMapProvider cannot be initialized twice.");

			initialized = true;
			if (attributes != null) {
				foreach (string key in attributes.AllKeys) {
					switch (key) {
						case "siteMapFile":
							fileVirtualPath = base.MapUrl (attributes ["siteMapFile"]);
							break;

						case "description":
						case "securityTrimmingEnabled":
							break;
							
						default:
							throw new ConfigurationErrorsException ("The attribute '" + key + "' is unexpected in the configuration of the '" + name + "' provider.");
					}
				}
			}
			
			base.Initialize (name, attributes != null ? attributes : new NameValueCollection ());
		}

Usage Example

示例#1
0
        private SiteMapNode GetNodeFromSiteMapFile(XmlNode xmlNode, VirtualPath siteMapFile)
        {
            SiteMapNode node = null;

            // For external sitemap files, its secuity setting is inherited from parent provider
            bool secuityTrimmingEnabled = SecurityTrimmingEnabled;

            HandlerBase.GetAndRemoveBooleanAttribute(xmlNode, _securityTrimmingEnabledAttrName, ref secuityTrimmingEnabled);

            // No other attributes or non-comment nodes are allowed on a siteMapFile node
            HandlerBase.CheckForUnrecognizedAttributes(xmlNode);
            HandlerBase.CheckForNonCommentChildNodes(xmlNode);

            XmlSiteMapProvider childProvider = new XmlSiteMapProvider();

            // siteMapFile was relative to the sitemap file where this xmlnode is defined, make it an application path.
            siteMapFile = _normalizedVirtualPath.Parent.Combine(siteMapFile);

            childProvider.ParentProvider = this;
            childProvider.Initialize(siteMapFile, secuityTrimmingEnabled);
            childProvider.BuildSiteMap();

            node = childProvider._siteMapNode;

            ChildProviderTable.Add(childProvider, node);
            _childProviderList = null;

            return(node);
        }
All Usage Examples Of System.Web.XmlSiteMapProvider::Initialize