您能否在asp:Menu控件中有2个指向同一页面的URL? [英] Can you have 2 url's that point to the same page in an asp:Menu control?

查看:138
本文介绍了您能否在asp:Menu控件中有2个指向同一页面的URL?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个asp:Menu,它包含一个指向 http://的顶级菜单项www.example.com/one.aspx .当您将鼠标悬停在顶层菜单项上时,它会显示一个下拉菜单,并且其中一项是" http://www.example.com/one.aspx .显然,我做不到,所以我一直在放一个?在第二个网址的末尾绕过此问题.我很好奇,是否有可能在asp:Menu中有两个指向相同位置的网址?

I have an asp:Menu and it contains a top level menu item that points to http://www.example.com/one.aspx. When you hover over the top level menu item, it shows a dropdown and one of the selections is One which points to http://www.example.com/one.aspx. Apparently, I can't do this, so I have been putting a ? at the end of the second url to get around this. I was curious as to if it is possible to have two of urls pointing to the same location in an asp:Menu?

推荐答案

我遇到了同样的问题,并且使用了稍微不同的解决方案:我在URL中添加了锚点,例如:

I had the same problem and used a slight variation of your solution: I added anchors to the URL, e.g:

  • http://www.example.com/one.aspx#1
  • http://www.example.com/one.aspx#2

顺便说一句:我使用的是站点地图文件,当您使用相同的URL添加到该文件的节点时,错误/异常非常清楚:

BTW: I was using a sitemap file, and when you add to nodes with the same URL to that file, then the error/exception is pretty clear:

多个具有相同URL的节点 '/WebSite1/MyPage.aspx'是 成立. XmlSiteMapProvider要求 该站点地图节点具有唯一的URL.

Multiple nodes with the same URL '/WebSite1/MyPage.aspx' were found. XmlSiteMapProvider requires that sitemap nodes have unique URLs.

所以我想实际上不可能有相同的URL.

So I guess it really is not possible to have to identical URLs.

这篇关于您能否在asp:Menu控件中有2个指向同一页面的URL?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆