如何在一个站点里定义多个sitemap---针对asp.net2.0

You can add multiple SiteMap Providers in your web.config. Each one could map to a specific sitemap file (left.sitemap, right.sitemap, etc.). Then you could do something like this with each Menu bound to a different SiteMapDataSource:

SiteMapDataSource1.Provider = SiteMap.Providers["left"];   //这里实际上提示我们可以编程实现


如何设计时实现呢?

假设我们站点下有2个sitemap文件:web.sitemap , left.sitemap

在web.config里如下设定:
  <siteMap defaultProvider="XmlSiteMapProvider" enabled="true">
   <providers>
    <add name="XmlSiteMapProvider"
            description="SiteMap provider which reads in .sitemap XML files."
            type="System.Web.XmlSiteMapProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
            siteMapFile="web.sitemap"
            securityTrimmingEnabled="true"/>
    <add name="left"
            description="SiteMap provider which reads in .sitemap XML files."
            type="System.Web.XmlSiteMapProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
            siteMapFile="left.sitemap"
            securityTrimmingEnabled="true"/>
   </providers>
  </siteMap>

设计时,在SiteMapDataSource1属性窗口的SiteMapProvider 里填 left 即可

阅读更多
想对作者说点什么?

博主推荐

换一批

没有更多推荐了,返回首页