Reputation: 1171
I am new to web development, and what I am trying to do is a simple back-forward navigation using hyperlinks.
In main page I have the link to the second page like this:
<a href="/development/html/test2.aspx">This is the LINK to the second page</a>
and then in this second page, I have a link that points back to the main page like this:
<a href="/development/html/test1.aspx">This is the LINK to the first page</a>
but when I click this link in the second page, it can't find the main page. Here is also the site map xml:
<siteMapNode url="~/development/html/test1.aspx" title="test1" description="test1">
<siteMapNode url="~/development/html/test2.aspx" title="test2" description="test2">
<siteMapNode url="~/development/html/test1.aspx" title="test1" description="test1"/>
</siteMapNode>
</siteMapNode>
I get the following error:
Server Error in '/' Application. The resource cannot be found. Description: HTTP 404. The resource you are looking for (or one of its dependencies) could have been removed, had its name changed, or is temporarily unavailable. Please review the following URL and make sure that it is spelled correctly.
Requested URL: /development/html/test1.aspx
Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.6.1586.0
Upvotes: 0
Views: 86
Reputation: 95
It looks like your test1.aspx and test2.aspx are in the same folder, so I dont think you have to navigate through your folders. try this:
<a href="test1.aspx">text</a>
and
<a href="test2.aspx">text</a>
Edit
You can try using response.redirect(); like this:
give your href the runat="server" property:
<a href="#" runat="server" onserverclick="goToSecondPage">This is the LINK to the second page</a>
And in your C# you can then do :
protected void goToSecondPage(object sender, EventArgs e)
{
Response.Redirect("test2.aspx");
}
Upvotes: 1