MVCSitemap - 维护子页面中的ID参数
我的网站具有以下结构:
/Products/ /Details/{ID} /Details/Edit/{ID}
它与大多数网站通常采用的 /products/edit 和 /products/details 方法略有不同,因为编辑链接仅在“详细信息”页面上可用。
我的问题是 ASP.NET MVCSitemap 不维护站点地图中的键。因此,当我在编辑页面上时,它会生成以下内容:
<a href="/Products">Products</a>
<a href="/Products/Details">Details</a>
<a href="/Products/Details/Edit/{id}">Edit</a>
而不是我期望的 HTML:
<a href="/Products">Products</a>
<a href="/Products/{id}/Details">Details</a>
<a href="/Products/Details/Edit/{id}">Edit</a>
请注意,第二个链接中没有键。有没有简单的方法来解决这个问题?
I've got the following structure to a site:
/Products/ /Details/{ID} /Details/Edit/{ID}
It's slightly different from the usual /products/edit and /products/details approach most sites have, because the edit link is only available on the Details page.
My problem is ASP.NET MVCSitemap doesn't maintain the keys in the sitemap. So when I'm on the edit page it produce a crumbtrail of:
<a href="/Products">Products</a>
<a href="/Products/Details">Details</a>
<a href="/Products/Details/Edit/{id}">Edit</a>
instead of the HTML I'm expecting:
<a href="/Products">Products</a>
<a href="/Products/{id}/Details">Details</a>
<a href="/Products/Details/Edit/{id}">Edit</a>
Notice that the 2nd link has no key in it. Is there a simple way to fix this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我自己发现这是当前版本(1.0.1)的问题 - 因为示例项目无法为具有 Id 的父链接正确呈现 crumbtrail。更多详细信息请参见此处。
I found out myself that this is an issue with the current version (1.0.1) - as the example project doesn't render the crumbtrail properly for parent links with Ids. More details here.
新版本 2.1.0 可能会修复此问题。检查 http://mvcsitemapprovider.com
New version 2.1.0 may fix this issue. Check http://mvcsitemapprovider.com