为了构建我的网站,我选择使用 Visual Studio 2010 环境。所以,我有工厂,互联网冲浪者可以通过两种不同的方式去那里。一种方法是从地图中选择地理名称,这会将他驱动到我目录树中某个位置的 aspx 文件中。第二种方法是从产品页面找到工厂。在第二种方式中,我在我的代码中使用“站点地图”,并在我的 web.config 文件中使用适当的条目;
<siteMap defaultProvider="XmlSiteMapProvider" enabled="true">
<providers>
<add name="XmlSiteMapProvider" description="Default SiteMap provider" type="System.Web.XmlSiteMapProvider" siteMapFile="Web.sitemap" securityTrimmingEnabled="true"/>
<add name="ProductsSiteMapProvider" description="Products SiteMap provider" type="System.Web.XmlSiteMapProvider" siteMapFile="Products.sitemap" securityTrimmingEnabled="true"/>
</providers>
在我的 products.sitemap 中,我正在写以下条目;
<siteMap xmlns="http://schemas.microsoft.com/AspNet/SiteMap-File-1.0" >
<siteMapNode url="~/pages/products.aspx" title="Products" description="Greek Olive Products">
<siteMapNode url="~/pages/products/oevoo/oevoo.aspx" title="Organic Extra Virgin Olive Oil" description="Find the Cultivation areas for this commodity" >
<siteMapNode url="~/pages/products/oevoo/agioideka.aspx" title="Flathiakes" description="Cultivation Area Flathiakes, Herakleion Crete" />
<siteMapNode url="~/pages/products/oevoo/handrinos.aspx" title="Handrinos" description="Cultivation Area Handrinos, village mountainous Messinia south-west Peloponnese " />
</siteMapNode>
<siteMapNode url="~/pages/products/evoo/evoo.aspx" title="Extra Virgin Olive Oil" description="Find the Cultivation areas for this commodity" >
<siteMapNode url="~/pages/districts/areas/agioideka.aspx" title="Flathiakes" description="Cultivation Area Flathiakes, Herakleion Crete" />
<siteMapNode url="~/pages/districts/areas/acova.aspx" title="Acova" description="Standardization factory in Argolida east Peloponnese" />
<siteMapNode url="~/pages/districts/areas/trikorfo.aspx" title="Trikorfo" description="Cultivation Area Trikorfo, mountainous area in south Peloponnese" />
<siteMapNode url="~/pages/districts/areas/handrinos.aspx" title="Handrinos" description="Cultivation Area Handrinos, village mountainous Messinia south-west Peloponnese " />
</siteMapNode>
<siteMapNode url="~/pages/products/voo/voo.aspx" title="Virgin Olive Oil" description="Find the Cultivation areas for this commodity" >
<siteMapNode url="~/pages/districts/areas/acova.aspx" title="Acova" description="Standardization factory in Argolida east Peloponnese" />
<siteMapNode url="~/pages/districts/areas/trikorfo.aspx" title="Trikorfo" description="Cultivation Area Trikorfo, mountainous Messinia south Peloponnese" />
</siteMapNode>
<siteMapNode url="~/pages/products/to/to.aspx" title="Greek Table Olives" description="Find the Cultivation areas for this commodity" >
<siteMapNode url="~/pages/districts/areas/trikorfo.aspx" title="Trikorfo" description="Cultivation Area Trikorfo, mountainous Messinia south Peloponnese" />
</siteMapNode>
</siteMapNode>
最后,当我尝试(本地)运行我的网站时,它给了我以下错误;
找到具有相同 URL '/WebSite2/pages/districts/areas/acova.aspx' 的多个节点。XmlSiteMapProvider 要求站点地图节点具有唯一的 URL。
当然,我看到站点地图提供者不接受多个指向同一位置的 url。我的问题是如何在 products.sitemap 中使用多个条目?