Different behaviour in staging/production environment

Nov 29, 2010 at 2:54 PM
Edited Nov 29, 2010 at 2:54 PM

Hello

I am using the SiteMap provider to create a site map page and sitemap.xml file with some static and some generated nodes.  The provider works fine in my visual studio project but when i use a web deployment project and deploy to a staging environment, the site map page fails to render properly but the sitemap.xml file is generated fine.

The configuration is as follows:

  <siteMap defaultProvider="MvcSiteMapProvider" enabled="true">
   <providers>
    <clear />
    <add name="MvcSiteMapProvider"
       type="MvcSiteMapProvider.DefaultSiteMapProvider, MvcSiteMapProvider"
       siteMapFile="~/Web.Sitemap"
       securityTrimmingEnabled="false"
       cacheDuration="0"
       enableLocalization="false"
       scanAssembliesForSiteMapNodes="false"
       skipAssemblyScanOn=""
       attributesToIgnore=""
       nodeKeyGenerator="MvcSiteMapProvider.DefaultNodeKeyGenerator, MvcSiteMapProvider"
       controllerTypeResolver="MvcSiteMapProvider.DefaultControllerTypeResolver, MvcSiteMapProvider"
       actionMethodParameterResolver="MvcSiteMapProvider.DefaultActionMethodParameterResolver, MvcSiteMapProvider"
       aclModule="MvcSiteMapProvider.DefaultAclModule, MvcSiteMapProvider"
       siteMapNodeUrlResolver="MvcSiteMapProvider.DefaultSiteMapNodeUrlResolver, MvcSiteMapProvider"
       siteMapNodeVisibilityProvider="MvcSiteMapProvider.DefaultSiteMapNodeVisibilityProvider, MvcSiteMapProvider"
       siteMapProviderEventHandler="MvcSiteMapProvider.DefaultSiteMapProviderEventHandler, MvcSiteMapProvider"
         />
   </providers>
  </siteMap>


The sitemap file:

<?xml version="1.0" encoding="utf-8" ?>
<mvcSiteMap xmlns="http://mvcsitemap.codeplex.com/schemas/MvcSiteMap-File-2.0" enableLocalization="true">
 <mvcSiteMapNode title="Site Map" url="" description="" clickable="false" changeFrequency="Always" controller="" updatePriority="" action="">
  <mvcSiteMapNode title="Priority" url="" description="" clickable="false" changeFrequency="Always" controller="Home" updatePriority="Normal" action="Index">
   <mvcSiteMapNode title="Home" url="/Home" description="Description for this" changeFrequency="Always" controller="Home" updatePriority="Normal" action="Index" />
   <mvcSiteMapNode title="About Priority" description="Description for this" url="/About" changeFrequency="Always" controller="Home" updatePriority="Normal" action="About" />
   <mvcSiteMapNode title="Perks at the O2" description="Description for this" url="/Perks" changeFrequency="Always" controller="Home" updatePriority="Normal" action="Perks" />
   <mvcSiteMapNode title="FAQs" url="/Faqs" description="Description for this" changeFrequency="Always" controller="Home" updatePriority="Normal" action="FAQs" />
   <mvcSiteMapNode title="Priority RSS" description="Description for this" url="/RSS/Priority" changeFrequency="Always" controller="Home" updatePriority="Normal" action="RssPriority" />
   <mvcSiteMapNode title="Sign In" description="Description for this" url="/SignIn" changeFrequency="Always" controller="Account" updatePriority="Normal" action="SignIn" />
   <mvcSiteMapNode title="My Account" description="Description for this" url="/MyAccount" changeFrequency="Always" controller="Account" updatePriority="Normal" action="EditUserDetails" />
   <mvcSiteMapNode title="Priority Items" url="" description="" clickable="false" changeFrequency="Always" controller="Priority" updatePriority="Normal" action="Priority">
    <mvcSiteMapNode title="PriorityDetails" dynamicNodeProvider="ABC.MVC.WebSite.Helpers.PrioritySearchResultsDynamicSiteMapNodeProvider, ABC.MVC.WebSite" updatePriority="Normal" changeFrequency="Always" />
   </mvcSiteMapNode>
   <mvcSiteMapNode title="Venues" url="" description="" clickable="false" changeFrequency="Always" controller="Venues" updatePriority="Normal" action="Venues">
    <mvcSiteMapNode title="VenuesDetails" dynamicNodeProvider="ABC.MVC.WebSite.Helpers.VenueDynamicSiteMapNodeProvider, ABC.MVC.WebSite" updatePriority="Normal" changeFrequency="Always" />
   </mvcSiteMapNode>
  </mvcSiteMapNode>
  <mvcSiteMapNode title="Business" url="/Business" description="" clickable="false" changeFrequency="Always" controller="Business" updatePriority="Normal" action="Home">
   <mvcSiteMapNode title="Home" url="/Business" description="Description for this" changeFrequency="Always" controller="Business" updatePriority="Normal" action="Home" />
   <mvcSiteMapNode title="Offers" url="/Business/Offers" description="Description for this" changeFrequency="Always" controller="Business" updatePriority="Normal" action="Offers" />
  </mvcSiteMapNode>
 </mvcSiteMapNode>
</mvcSiteMap>

 


I am using slightly modified helper templates.  The HTML returned by  <%=Html.MvcSiteMap().SiteMap()%> in visual studio looks like this, for brevity i am using the sitemap xml provided inthe documentation, but the behaviour is the same as it is with my xml above:

 <ul class="siteMap">
  <li><a href="/Home/Index/Favourites" class="SitemMapLink">Home</a>
   <ul>
    <li><a href="/Business?action=Index&controller=Store" class="SitemMapLink">Browse Store</a> </li>
    <li><a href="/Business?action=Index&controller=Checkout" class="SitemMapLink">Checkout</a> </li>
   </ul>
  </li>
 </ul>

On the staging environment however, the html rendered is:


 <ul class="siteMap">
  <li><a href="/Home/Index/Favourites" class="SitemMapLink">Home</a> <a href="/Business?action=Index&controller=Store" class="SitemMapLink">Browse Store</a> <a href="/Business?action=Index&controller=Checkout" class="SitemMapLink">Checkout</a> </li>
 </ul>

It seems that for the tree of nodes that the parent/child relationship has broken down.  The staging server is IIS6.  Is there any explanation for this behaviour you can think of?

Thanks!

Coordinator
Dec 2, 2010 at 12:21 PM

Can you remove the url attribute from your sitemap? This will be autogenerated at runtime.