0
votes

Hi, everyone. I have a problem related to my code for an assignment. I am trying to configure my web.sitemap file but I am getting the following when I run my code:

Exactly one element is required directly inside the element.

Description: 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.Configuration.ConfigurationErrorsException: Exactly one element is required directly inside the element.

The siteMapNode for the url="CustomerSupport" is getting an error and it says that: The element 'siteMap' in namespace 'http://schemas.microsoft.com/AspNet/SiteMap-File-1.0' has invalid child element 'siteMapNode' in namespace I have been stuck with this for a while. I'd really appreciate some help. Here is my code for the we.sitemap file:

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

      <siteMapNode url="Customer support.aspx" title="Customer support"  description="">
          <siteMapNode url="ProductRegistration.aspx" title="Register products"  description="">
          </siteMapNode>
          <siteMapNode url="CustomerSurvey.aspx" title="Complete customer survey"  description="">
          </siteMapNode>
          <siteMapNode url="ContactUs.aspx" title="Contact us"  description="">
          </siteMapNode>
      </siteMapNode>

      <siteMapNode url="TechnicianSupport.aspx" title="Technician support"  description="">
          <siteMapNode url="CustomerIncidentDisplay.aspx" title="Display customer incidents"  description="">
          </siteMapNode>
          <siteMapNode url="IncidentUpdate.aspx" title="Update incidents"  description="">
          </siteMapNode>
      </siteMapNode>

      <siteMapNode url="Administration.aspx" title="Administration"  description="">
          <siteMapNode url="ProductMaintenance.aspx" title="Maintain products"  description="">
          </siteMapNode>
          <siteMapNode url="CustomerMaintenance.aspx" title="Maintain customers"  description="">
          </siteMapNode>
          <siteMapNode url="TechnicianMaintenance.aspx" title="Maintain technicians"  description="">
          </siteMapNode>
          <siteMapNode url="IncidentCreation.aspx" title="Create incidents"  description="">
          </siteMapNode>
          <siteMapNode url="TechnicianIncidentSummary.aspx" title="Display techninican incidents"  description="">
          </siteMapNode>
          <siteMapNode url="IncidentAssignment.aspx" title="Assign incidents"  description="">
          </siteMapNode>
          <siteMapNode url="IncidentDisplay.aspx" title="Display incidents"  description="">
          </siteMapNode>
          <siteMapNode url="CustomerDisplay.aspx" title="Display customers"  description="">
          </siteMapNode>
      </siteMapNode>

      <siteMapNode url="Map.aspx" title="Site Map"  description="">
        </siteMapNode>
</siteMap>
1
Do you have space in file name Customer support.aspxRaghuveer
You probably want to put all of the nodes inside the first (default.aspx) node.MikeSmithDev
MikeSmithDev - Thanks. I entered all the nodes in the first node and it worked. RVG - That was an additional error that I didn't even know was there. Thanks for pointing that out.user1976537

1 Answers

0
votes

You have many nodes where you should only have one: Inside the main node, put the rest of them.

<siteMapNode name="this is the main node">

  <siteMapNode name="1">
    <siteMapNode name="11">
    </siteMapNode>

    <siteMapNode name="12">
    </siteMapNode>
  </siteMapNode>

  <siteMapNode name="2">
  </siteMapNode>

  <siteMapNode name="3">
  </siteMapNode>
</siteMapNode>