• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 413
  • Last Modified:

Asp.net Changing sitemaps on the fly

OK, I see this question has been asked and sometimes answered but still can't figure out what I'm doing wrong.  I have a few different sitemaps declared.  When a user logs in, the program gathers thier security level and assigns a sitemap based on who they are.  Can't get it to work, please help!

Here's the code:
In Site:Master
       <asp:SiteMapDataSource ID="SiteMapPublic" runat="server" />
       <asp:Menu runat="server" ID="MainMenu" CssClass="menu" EnableViewState="false" IncludeStyleBlock="false" StaticDisplayLevels="2"
            Orientation="Horizontal" DataSourceID="SiteMapPublic"/>


In Web.Config file:
   <siteMap defaultProvider="SiteMapQDSAdmin" enabled="true">
      <providers>
        <add name="SiteMapPublic" type="System.Web.XmlSiteMapProvider" siteMapFile="~/App_Data/Public.sitemap" />
        <add name="SiteMapQDSAdmin" type="System.Web.XmlSiteMapProvider" siteMapFile="~/App_Data/QDSAdmin.sitemap" />
        <add name="SiteMapQDSViewer" type="System.Web.XmlSiteMapProvider" siteMapFile="~/App_Data/QDSViewer.sitemap" />
        <add name="SiteMapVendor" type="System.Web.XmlSiteMapProvider" siteMapFile="~/App_Data/Vendor.sitemap" />          
        <add name="SiteMapClient" type="System.Web.XmlSiteMapProvider" siteMapFile="~/App_Data/Client.sitemap" />
      </providers>
    </siteMap>
0
QualityData
Asked:
QualityData
1 Solution
 
Vikram Singh SainiSoftware Engineer cum AD DeveloperCommented:
Your question statement:

When a user logs in, the program gathers thier security level and assigns a sitemap based on who they are.  


So are you trying to set some sitemap to SiteMapDataSource at runtime?

If yes, in that case you can use: (Check more

SiteMapPublic.SiteMapProvider="SomeProviderDeclaredInWebConfig";

Open in new window


You can also look at link:

http://www.dotnetspider.com/resources/22817-Creating-SiteMap-according-user-role.aspx
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: Microsoft Exchange Server

The MCTS: Microsoft Exchange Server 2010 certification validates your skills in supporting the maintenance and administration of the Exchange servers in an enterprise environment. Learn everything you need to know with this course.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now