爲了構建我的網站,我選擇使用Visual Studio 2010環境。 因此,我有工廠,網上衝浪者可以從兩種不同的方式去那裏。 一種方法是從地圖上選擇地理名稱,這會將他驅動到目錄樹中某個地方的aspx文件中。 第二種方法是從產品頁面查找工廠。 在第二種方式中,我使用我的代碼中的「站點地圖」和我的web.config文件中的相應條目;具有相同URL的多個節點
<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。
當然,我看到網站地圖提供程序不接受多個網址導致相同的位置。 我的問題是我能做些什麼來在我的products.sitemap中使用多個條目?
可能重複你能必須要2個url指向asp:Menu控件中的相同頁面?](http://stackoverflow.com/questions/458287/can-you-have-to-2-urls-that-point-the-the - 同一頁的aspmenu控制) – Matt