gpt4 book ai didi

asp.net - 多个节点具有相同的 URL

转载 作者:行者123 更新时间:2023-12-02 16:57:16 25 4
gpt4 key购买 nike

为了构建我的网站,我选择使用 Visual studio 2010 环境。所以,我有工厂,互联网冲浪者可以通过两种不同的方式到达那里。一种方法是从 map 中选择地理名称,这会将其驱动到目录树中某个位置的 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>

最后,当我尝试(本地)运行我的网站时,出现以下错误;

Multiple nodes with the same URL '/WebSite2/pages/districts/areas/acova.aspx' were found. XmlSiteMapProvider requires that sitemap nodes have unique URLs.

当然,我发现站点地图提供商不接受指向同一位置的多个网址。我的问题是如何在我的 products.sitemap 中使用多个条目?

最佳答案

是的,您可以,微软建议对网址进行一些更正,例如添加 # 或提供参数:

~/pages/districts/areas/acova.aspx
~/pages/districts/areas/acova.aspx#
~/pages/districts/areas/acova.aspx?id=1

都是不同的网址,但相同的页面

关于asp.net - 多个节点具有相同的 URL,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10589690/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com