向 web.sitmap 中的节点添加属性是一个坏主意吗?

发布于 2024-07-10 04:55:41 字数 332 浏览 9 评论 0原文

我使用 SiteMapPath 和 xml 文件来获取数据。 我想对另一个菜单使用相同的文件,但我需要将更多信息附加到每个节点。

<siteMapNode target="_blank" url="~/Default.aspx" title="Home"  description="Home Page" >
VS
<siteMapNode url="~/Default.aspx" title="Home"  description="Home Page" >

到目前为止,它还没有损坏我的盒子,但是我以后会遇到问题吗? 或者,还有更好的方法?

I using SiteMapPath with an xml file for data. I would like to use the same file for another menu, but I need to have more information attached to each node.

<siteMapNode target="_blank" url="~/Default.aspx" title="Home"  description="Home Page" >
VS
<siteMapNode url="~/Default.aspx" title="Home"  description="Home Page" >

So far it doesn't break on my box, but will I run into problems later? Or is there a better way?

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

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

发布评论

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

评论(4

2024-07-17 04:55:42

Microsoft 一直希望 siteMapNode 元素允许在其上自定义属性。 您可以使用索引器<访问这些属性的值/a> 在 SiteMapNode 类上。

ASP.NET 快速入门教程此处简要提到了此功能

Microsoft has always intended for siteMapNode elements to allow custom attributes on them. You can access the values of those attributes with the indexer on the SiteMapNode class.

The ASP.NET QuickStart Tutorials briefly mention this feature here.

好倦 2024-07-17 04:55:42

怀疑你会遇到任何问题。 无论消耗站点地图文件的是什么,都只会解析已知的属性。 额外的属性将被忽略。

Doubtfull you'll run into any problems. Whatever is consuming your sitemap file is only going to parse known attributes. Extra attributes will go ignored.

赤濁 2024-07-17 04:55:42

我经常使用这种方法并且使用了相当长的一段时间。 它没有给我带来任何问题。 唯一的缺点是解析它们所需的代码。

I use this approach quite often and for quite some time. It has not caused me any problems. The only downside is the code needed to parse them.

凉城 2024-07-17 04:55:42

我同意其他答案。 XML 是可扩展的。

I agree with the other answers. XML is meant to be eXtensible.

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