ASP MVC 站点地图与 MvcSiteMap

发布于 2024-08-30 11:40:15 字数 460 浏览 0 评论 0原文

MvcSiteMap - https://github.com/maartenba/MvcSiteMapProvider [最初位于:http://mvcsitemap.codeplex.com/]

是否可以使用 MvcSitemap 在站点地图中创建此类链接? 我可以创建一个简单的站点地图,但不能创建带有以下链接的站点地图

。 ... .com/Eventname/groupID/Tasks/Details/taskID

事件名称、groupID、TaskID 是动态的。

如果没有,我的问题还有其他解决方案吗?

MvcSiteMap - https://github.com/maartenba/MvcSiteMapProvider [originally at: http://mvcsitemap.codeplex.com/]

Is it possible to create such links in a sitemap with MvcSitemap?
I can create a simple sitemap but not one with the link below..

www. ... .com / Eventname / groupID /Tasks/ Details/ taskID

Eventname, groupID, TaskID are dynamic.

If not is there another solution for my problem?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

贱贱哒 2024-09-06 11:40:15

我知道这个答案来得有点晚了,但我自己在上周才学会了 MvcSitemap,并在我自己的项目中按照 OP 的问题使用它。

这当然是可以实现的。您可以通过创建自定义节点提供程序来定义站点地图节点,在其中根据您提到的自定义路由传入每个节点的路由值。即使 MvcSiteMap 的版本 1 也允许动态节点,但 v2.0 似乎更加灵活 - 并且它支持 MVC2 区域。

查看 项目 wiki 条目。 com/maartenba/MvcSiteMapProvider/wiki/Defining-sitemap-nodes-in-code" rel="nofollow noreferrer">在代码中定义站点地图节点。示例项目也非常好。如果您只安装了 SQL Express,则可能需要从原始 MVCMusicStore 项目中获取 DB 文件,因为 MvcSiteMap 示例中包含的 DB 文件仅适用于 SQL Server 的付费版本。

I know this answer comes a little late, but I've just picked up on MvcSitemap myself in the last week and am using it as per the OP's question in my own project.

It's certainly achievable. You can define sitemap nodes by creating a custom node provider, within which you pass in the route values for each node, based on the custom route you mentioned. Even version 1 of MvcSiteMap allowed for dynamic nodes, but v2.0 seems a lot more flexible - and it supports MVC2 Areas.

Have a look at the project wiki entry on defining sitemap nodes in code. The sample project is pretty good too. If you only have SQL Express installed, you may need to grab the DB files from the original MVCMusicStore project as the DB files included with the MvcSiteMap sample will only work on paid versions of SQL server.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文