Reputation: 315
I apologize if this is a basic question, but allow me to just ask.
So I have three webpages.
/Project/MainPages/Default.aspx
/Project/Forum/Forum.aspx
/Project/Accounts/Login/Login.aspx
I am using html href to transfer between pages. Issue is that, as long as I'm not in the login page, I can transfer between pages freely. But once I move towards the login page and attempt to move to another page such as homepage or forum, it returns me Resource Not Found, with the path of: /Project/Accounts/MainPages/Default.aspx or /Project/Accounts/Forum/Forum.aspx if I click on forum instead.
I've checked my hrefs are fine
<li><a href="../Main Pages/Default.aspx">Home</a></li>
<li><a href="../Forum/Forum.aspx">Forum</a></li>
<li><a href="../Account/Login/Login.aspx">Log In</a></li>
^ these are put in my masterpage. Naturally all pages will have these links if they are referenced to masterpage. By the way, the links are generated when I "pick url" and specify the location of each web file.
Is it related to validation problems in login page? Just to add, it contains red labels that checks if users entered correct detail formats before submitting the login button.
The login page contains both login and signup options. Signup redirects it to the signup page only, though.
Upvotes: 2
Views: 1084
Reputation: 9201
The ..
you are using means "Previous folder".
So if you're into /Project/MainPages
and do ..
, it will resolve to the project root /Project
, which is fine.
However, when you're in /Project/Accounts/Login
and use ..
, you fall back to /Project/Accounts
, not /Project
. So your Main Pages
and Forum
folders are not visible (because you're one folder too far).
To solve this problem, instead of using relative paths, use absolute paths starting from the root of your project:
<li><a href="~/Main Pages/Default.aspx">Home</a></li>
<li><a href="~/Forum/Forum.aspx">Forum</a></li>
<li><a href="~/Account/Login/Login.aspx">Log In</a></li>
or, only from your Login
page, go back one more folder in the hierarchy to find the other two pages:
<li><a href="../../Main Pages/Default.aspx">Home</a></li>
<li><a href="../../Forum/Forum.aspx">Forum</a></li>
<li><a href="../Account/Login/Login.aspx">Log In</a></li>
Upvotes: 2