[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 390
  • 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

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

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