Reputation: 65
I am creating a website and I'm trying to implement routing feature. Most of the time it works fine, but I've found a problem while routing between different web forms placed at different levels from the root of the website.
The above picture shows all the routes defined and picture below shows the solution explorer of my project:
Home page(home.aspx) of my website is shown below:
On clicking the picture it opens a new page(singlepage.aspx) with whole article about the topic and contains the required url(sitename/heading/querystring):
But from there when i click on HOME button, it does not take me to home page, but instead gets me to the url like this:
Seems like it is not calling the "routeHome" route, instead calls "routeSinglePage".
This is how the html for taking us to HOME page is:
So I wanted to know how I can get it to the home page from singlepage.aspx by clicking on HOME button. Do I need to add new routes or something else.
Thanks
Upvotes: 0
Views: 106
Reputation: 1001
Change the HTML to:
<li><a href="/Home">Home</a></li>
<li><a href="/AbousUs">About</a></li>
<li><a href="/ContactUs">Contact</a></li>
The "/" indicates an absolute path, you are currently using a relative path and hence the issue.
Upvotes: 1