Windows Azure Web Role: Exception in SiteMapProvider Object (System.Web.UI.WebControls.SiteMapDataSource)

If you are using SiteMapProvider (SiteMap Provider) Object in  your Windows Azure web role you might receive following exception randomly:

Exception type: ArgumentException
Exception message: Could not find the sitemap node with URL '~/appdir/testapplicaiton.aspx'.
at System.Web.UI.WebControls.SiteMapDataSource.GetNodes()
at System.Web.UI.WebControls.SiteMapDataSource.GetTreeView(String viewPath)

Further investigation reveals that the virtual path being requested is /(A#dfesdef32sdefggjiwefserfs1))/appdir/testapplication.aspx.

As you can see above, the virtual path for the page contains a SessionID… which breaks the relative path for this Site Map and cause the exception. 

There are following ways you can solve this problem:

  1. You can use Absolute Paths to solve this problem. This is much better solution to solve this problem.
  2. Use the following hotfix (  in your Windows Azure VM to solve this problem.

To Install above hotfix in your Windows Azure Virtual Machine, you can use Start up task in your role. The learn about Windows Azure Startup task visit:

Comments (0)

Skip to main content