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.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:
- You can use Absolute Paths to solve this problem. This is much better solution to solve this problem.
- Use the following hotfix (http://support.microsoft.com/kb/2472263) in your Windows Azure VM to solve this problem.
- Fix: URLs that are generated by the SiteMapProvider object in ASP.NET 4 are incorrect when you use cookieless mode for sessions or cookieless forms authentication
- Before using the above hotfix, please check ASP.Net DLL version in Windows Azure VM. The Hotfix creates ASP.NET DLL version 4.0.30319.206 – so you may have an older version of DLL then this.
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: