[英]query string parameters for sitemap
I'm using VWD 2010, ASP.NET with C#. 我正在使用C#使用VWD 2010,ASP.NET。 I found a pointer for how to do this in another SO post. 我在另一个SO帖子中找到了如何执行此操作的指针。 Unfortunately, I can't get it working. 不幸的是,我无法正常工作。
The sample code it points to is here: http://weblogs.asp.net/jgaylord/adding-querystring-parameters-to-the-sitemapnode 它指向的示例代码在这里: http : //weblogs.asp.net/jgaylord/adding-querystring-parameters-to-the-sitemapnode
I have included the C# code for this, but I can't seem to get the program to recognize that the code is actually there. 我已经为此添加了C#代码,但似乎无法让程序识别出该代码确实存在。 I set break points that never get invoked. 我设置了永远不会被调用的断点。
I put this into the web.config: 我把它放到web.config中:
<siteMap enabled="true">
<providers>
<clear/>
<add name="ExtendedSiteMapProvider" type="Configuration.ExtendedSiteMapProvider" siteMapFile="web.sitemap" securityTrimmingEnabled="true" />
<!--
<add siteMapFile="Web.sitemap" name="AspNetXmlSiteMapProvider" type="System.Web.XmlSiteMapProvider" securityTrimmingEnabled="true"/>
-->
</providers>
</siteMap>
Notice how AspNetXmlSiteMapProvider is commented out. 注意如何注释掉AspNetXmlSiteMapProvider 。 That name appears nowhere else in the file. 该名称在文件中其他任何地方都不会出现。 Nevertheless when I attempt to run my program, I get this error message: The provider 'AspNetXmlSiteMapProvider' specified for the defaultProvider does not exist in the providers collection. 但是,当我尝试运行程序时,会出现以下错误消息: 在provider集合中不存在为defaultProvider指定的provider'AspNetXmlSiteMapProvider'。
If I uncomment that line, the program runs, but the new code is never invoked. 如果我取消注释该行,则程序将运行,但永远不会调用新代码。 Any ideas? 有任何想法吗?
That's because you are not specifying the defaultProvider
which defaults exactly to AspNetXmlSiteMapProvide
, like you can see here . 那是因为您没有指定defaultProvider
,而defaultProvider
完全默认为AspNetXmlSiteMapProvide
, 就像您在这里看到的那样 。
So you just have to specify the defualt provider like this: 因此,您只需要指定像这样的默认提供程序即可:
<siteMap enabled="true" defaultProvider="ExtendedSiteMapProvider">
<providers>
....
</providers>
</siteMap>
Or specify the provider in corresponding SiteMpaDataSource
property , so that the default isn't used. 或在相应的SiteMpaDataSource
属性中指定提供程序,以便不使用默认值。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.