[RESOLVED]help me fix eror web.config when i add sitemap

please help me, thanks!

code in web.config:

            Set compilation debug="true" to insert debugging
            symbols into the compiled page. Because this
            affects performance, set this value to true only
            during development.
        <compilation debug="true"/>
            The <authentication> section enables configuration
            of the security authentication mode used by
            ASP.NET to identify an incoming user.
        <authentication mode="Windows"/>
            The <customErrors> section enables configuration
            of what to do if/when an unhandled error occurs
            during the execution of a request. Specifically,
            it enables developers to configure html error pages
            to be displayed in place of a error stack trace.

        <customErrors mode="RemoteOnly" defaultRedirect="GenericErrorPage.htm">
            <error statusCode="403" redirect="NoAccess.htm" />
            <error statusCode="404" redirect="FileNotFound.htm" />
    <siteMap defaultProvider="Menu">
        <add name="Menu" type="System.Web.XmlSiteMapProvider" siteMapFile="~/Menu.sitemap"/>



eror when i run web on localhost :

Server Error in ‘/abc’ Application.

Configuration Error

An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately.

Parser Error Message: Unrecognized element ‘provider’.

Source Error:

Line 38:         -->
Line 39:     <siteMap defaultProvider="Menu">
Line 40:       <provider> Line 41:         <add name="Menu" type="System.Web.XmlSiteMapProvider" siteMapFile="~/Menu.sitemap"/>
Line 42:       </provider>

Source File: C:UsersAppleDesktopNew folderdaivietweb.config Line:

Version Information: Microsoft .NET Framework Version:2.0.50727.4971; ASP.NET Version:2.0.50727.4955


You have mentioned Provider inside your sitemap node, which is not a valid node. You should mentioned it as ‘Providers‘.

Please change your code like given below

<siteMap defaultProvider="Menu">
        <add name="Menu" type="System.Web.XmlSiteMapProvider" siteMapFile="~/Menu.sitemap"/>

thanks! friend

but when i use it

Server Error in ‘/abc’ Application.

The file /daiviet/menu.sitemap required by XmlSiteMapProvider does not exist.

An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.InvalidOperationException: The file /daiviet/menu.sitemap required by XmlSiteMapProvider does not exist.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:

[InvalidOperationException: The file /daiviet/menu.sitemap required by XmlSiteMapProvider does not exist.]
   System.Web.XmlSiteMapProvider.CheckSiteMapFileExists() +153
   System.Web.XmlSiteMapProvider.GetConfigDocument() +596
   System.Web.XmlSiteMapProvider.BuildSiteMap() +231
   System.Web.XmlSiteMapProvider.get_RootNode() +33
   System.Web.UI.WebControls.SiteMapDataSource.GetNodes() +606
   System.Web.UI.WebControls.SiteMapDataSource.GetTreeView(String viewPath) +66
   System.Web.UI.WebControls.SiteMapDataSource.GetHierarchicalView(String viewPath) +193
   System.Web.UI.HierarchicalDataSourceControl.System.Web.UI.IHierarchicalDataSource.GetHierarchicalView(String viewPath) +39
   System.Web.UI.WebControls.HierarchicalDataBoundControl.GetData(String viewPath) +80
   System.Web.UI.WebControls.Menu.DataBindItem(MenuItem item) +111
   System.Web.UI.WebControls.Menu.PerformDataBinding() +99
   System.Web.UI.WebControls.HierarchicalDataBoundControl.PerformSelect() +114
   System.Web.UI.WebControls.BaseDataBoundControl.DataBind() +125
   System.Web.UI.WebControls.Menu.DataBind() +29
   System.Web.UI.WebControls.BaseDataBoundControl.EnsureDataBound() +104
   System.Web.UI.WebControls.Menu.EnsureDataBound() +70
   System.Web.UI.WebControls.BaseDataBoundControl.OnPreRender(EventArgs e) +43
   System.Web.UI.WebControls.Menu.OnPreRender(EventArgs e, Boolean registerScript) +89
   System.Web.UI.WebControls.Menu.OnPreRender(EventArgs e) +64
   System.Web.UI.Control.PreRenderRecursiveInternal() +170
   System.Web.UI.Control.PreRenderRecursiveInternal() +292
   System.Web.UI.Control.PreRenderRecursiveInternal() +292
   System.Web.UI.Control.PreRenderRecursiveInternal() +292
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint


This error occurs if XmlSiteMapProvider does not find sitemap file. Please ensure that you have mapped the file path properly.

Altenatively you can check the solution suggested in below link


thank you!

Leave a Reply