问题
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