views:

594

answers:

2

We have a requirement to load a different XML sitemap for each user that logs in. This sitemap can come from a variety of sources (webservice, database, file) and has to be loaded at runtime.

I have designed it thus: When a user logs in, the custom XML for that user is fetched and put into Session. In the BuildSiteMap() method of my custom SiteMapProvider, I need to load the XML as the sitemap. I know how to do this node-by-node, but my question is this: If XMLSiteMapProvider can load the sitemap data from an XML file, can I make it do the same from an in-memory sitemap file (by transforming my XML to sitemap XML) ?

Will appreciate any comments, thanks.

A: 

While it should technically be possible, i don't think this would be good approach because it contradicts the idea of a sitemap containing a complete site navigation and handling authorization by specifying users/groups for each node.

<?xml version="1.0" encoding="utf-8" ?>
  <siteMap>
    <!-- other <siteMapNode> elements -->
      <siteMapNode title="Support" 
       description="Support" 
       url="~/Customers/Support.aspx" 
       roles="Customers" />
  </siteMap>
Filburt
A: 

You can provide a siteMapFile attribute in a siteMapNode. Maybe this can help you further?

<?xml version="1.0" encoding="utf-8" ?>
<siteMap>
  <siteMapNode siteMapFile="~/users/xxx.sitemap" />
</siteMap>
Ropstah