4

I have an ASP.net site and I created a web.sitemap file in the root directory. It contains:

<?xml version="1.0" encoding="utf-8" ?>
<siteMap xmlns="http://schemas.microsoft.com/AspNet/SiteMap-File-1.0" >
<siteMapNode>
    <siteMapNode url="~/Default.aspx" title="Home" description="Rado Home" />
    <siteMapNode url="" title="Structural" description="">
      <siteMapNode url="" title="Doors" description=""/>
      <siteMapNode url="" title="Staircases" description=""/>
      <siteMapNode url="" title="Post Boxes" description=""/>
    </siteMapNode>

    <siteMapNode url="" title="Functional">
      <siteMapNode url="" title="Tables" />
      <siteMapNode url="" title="Features" />
    </siteMapNode>
    <siteMapNode url="" title="Sculpture">
      <siteMapNode url="" title="Wall" />
      <siteMapNode url="" title="Free Standing" />
    </siteMapNode>
    <siteMapNode url="" title="Smithing">
      <siteMapNode url="" title="Gold" />
      <siteMapNode url="" title="Silver" />
      <siteMapNode url="" title="Copper" />
    </siteMapNode>
    <siteMapNode url="~/About.aspx" title="About"/>
    <siteMapNode url="~/Contact.aspx" title="Contact"/>
  </siteMapNode>
 </siteMap>

I then created a menu in my master page as follows:

<asp:SiteMapDataSource ID="SiteMapDataSource1" Runat="server" />
            <asp:Menu ID="NavigationMenu" runat="server" CssClass="menu" EnableViewState="false" Orientation="Horizontal" DataSourceID="SiteMapDataSource1" />

When I run the site I get the following error: The file web.sitemap required by XmlSiteMapProvider does not exist.

Any ideas as to what could be wrong?

VARAK
  • 835
  • 10
  • 27

4 Answers4

2

Does your web.config contain a sitemap section?

<siteMap>
  <providers>
    <add name="SiteMapDataSource1" description="Default SiteMap provider." type="System.Web.XmlSiteMapProvider" siteMapFile="/MyApplication/Web.sitemap" />
    <add name="AdminSiteMap" description="Default SiteMap provider." type="System.Web.XmlSiteMapProvider" siteMapFile="/MyApplication/Admin.sitemap"  />
  </providers>
</siteMap>

like this?

rlb.usa
  • 14,942
  • 16
  • 80
  • 128
1

Did you call the sitemap you created web.sitemap?

If not, then you need to clear the providers in the sitemap tag & add a new provider that includes the name of your sitemap.

This shows the default entry in the root web.config that you need to clear

Simon Halsey
  • 5,459
  • 1
  • 21
  • 32
  • 1
    Yes, it's called web.sitemap and there's nothing in the config file for sitemaps. I'm stumped... – VARAK Apr 07 '11 at 20:03
0

this issue can also occur if you have created a website copying it from another website but you forgot to create the related application into IIS

Fabio Napodano
  • 1,210
  • 1
  • 16
  • 17
0

I fixed it. Apparently there weren't enough permissions on the web.sitemap file so whichever user the site was running as couldn't read the file. On that note, does anyone know how I can find out which user the site accesses files as?

VARAK
  • 835
  • 10
  • 27
  • that depends on the platform. On XP it's aspnet, but on Win2003 & later (iis 6 & 7) you're looking for w3wp process run by networkservice. – Simon Halsey Apr 08 '11 at 17:43
  • Cool, thanks. It helps clearing that up. That's strange though because I gave Network Service full permissions to the site. Ah well, it works now :) – VARAK Apr 09 '11 at 07:37
  • How did you add permissions to the user? – Nitin Sawant Nov 05 '14 at 11:50
  • Right click on the file, go to properties and then Security where you can edit permissions – VARAK Nov 28 '14 at 14:00