链接到asp.net中的主目录 [英] link to home directory in asp.net

查看:63
本文介绍了链接到asp.net中的主目录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

对于我正在开发的网站,主文件页脚中有一个指向主目录的链接。因此,我
使用了< a href = /> Home< / a> ,但是它不起作用。实际上,它需要我的网站名称,例如
< a href = / MySite>< / a> 来加载Default.aspx主目录。
我正在寻找一种独立于网站名称(此处是Mysite)指定URL的方法,因为我担心如果将来决定重命名主文件夹,使用网站名称可能会引起问题。 p>

For the website I am developing, there is to be a link to Home directory in the master file's footer. Thus, I
used <a href="/">Home</a> but it doesn't work. In fact it needs the name of my site, say
<a href="/MySite"></a> to load the Default.aspx of the home directory. I am looking for a way to specify the URL independent from whatever the name of my site is (here Mysite), because I fear using site name might raise issues in future if I decide to rename the home folder.

推荐答案

您可以尝试:

<asp:HyperLink ID="HyperLink1" runat="server" NavigateUrl="~/">Home</asp:HyperLink>

首页名称:Default.aspx

Home page name: Default.aspx

这篇关于链接到asp.net中的主目录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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