如何使用ASP.NET多个.sitemap文件 [英] How to use multiple .sitemap files in ASP.NET
问题描述
我觉得我缺少有关的Sitemaps一些东西明显。
I think I'm missing something obvious about sitemaps.
我试图用一个中继器来生成一个新的网站地图,我们有我们的网站上一些导航。但我不希望使用我们的正常Web.sitemap文件,我想用我们新的......我们会称之为Web.NEW.sitemap。
I'm trying to use a repeater to generate some navigation for a new sitemap we have on our site. But I don't want to use our normal Web.sitemap file, I want to use our new one...we'll call it "Web.NEW.sitemap".
在code似乎有点明显了点...
The code seems somewhat obvious to a point...
<asp:Repeater ID="rptMyRepeater" DataSourceID="mySitemap" runat="server">
<ItemTemplate>
blah blah blah
</ItemTemplate>
</asp:Repeater>
<asp:SiteMapDataSource ID="mySitemap" runat="server" />
但我怎么得到的SiteMapDataSource使用,而不是默认的sitemap Web.NEW.sitemap?我以为像添加一个属性:
But how do I get SiteMapDataSource to use Web.NEW.sitemap instead of the default sitemap? I thought adding an attribute like:
SiteMapProvider="Web.NEW.sitemap"
应该做的,但没有骰子。
ought to do it, but no dice.
我是什么失踪?
推荐答案
您必须正确配置您的web.config中使用的<一个href=\"http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.sitemapdatasource.sitemapprovider.aspx\">SiteMapDataSource属性。使用地图元素:
You have to configure your web.config properly to make use of the SiteMapDataSource property. Use the SiteMap element:
<siteMap defaultProvider="oldProvider">
<providers>
<clear />
<add name="oldProvider" type="System.Web.XmlSiteMapProvider" siteMapFile="web.sitemap" />
<add name="newProvider" type="System.Web.XmlSiteMapProvider" siteMapFile="Web.NEW.sitemap" />
</providers>
</siteMap>
,然后从web.config文件中设置SiteMapProvider属性供应商的名称。
and then set the SiteMapProvider property to the provider's name from the web.config file.
SiteMapProvider="newProvider"
这篇关于如何使用ASP.NET多个.sitemap文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!