link to home directory in asp.net

帅比萌擦擦* 提交于 2019-12-13 05:04:40

问题


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.


回答1:


You can try that:

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

Home page name: Default.aspx



来源:https://stackoverflow.com/questions/23034626/link-to-home-directory-in-asp-net

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!