Skip to content Skip to sidebar Skip to footer

Href Links To Subfolders

I searched and feel this is an elementary questions but I can't think straight I guess. So I have a simple subfolder in my website and pages I need to get to like this.

Solution 1:

Try this:

<ahref="~/Default.aspx"runat="server">Home</a><ahref="~/Subfolder/help.aspx"runat="server">Help</a>

Now, each link will resolve on the server-side, from the project root downwards.

Solution 2:

Relative URLs can be used when linking to pages within your own website. They provide a shorthand way of telling the browser where to find your files.

Repeat the ../ to indicate that you want to go up folders, then follow it with the file name. the code below makes the browser jump one folders back from the current folder (ie. that displays current webpage)

<ahref="../home.aspx">Home</a>

Since you made a simple subfolder sstructure my guess is that one simple jump will provide the required page. you may jump back two folders using ../../ or three folders using ../../../ and so on until you reach the required folder containing your file.

Or you can use the root link which starts with /, such links are know as root-relative links

<ahref ="/home.aspx">Home</a>

more about relative links: http://www.motive.co.nz/glossary/linking.php?ref

Post a Comment for "Href Links To Subfolders"