Click here to Skip to main content
16,012,223 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i have a master page with a menu. when i click on the link from default page it work fine but when i click a link from master page it give me an error because it automatically change the link

[http://localhost:54246/Pages/Default.aspx]

i will access the page if the link is like

[http://localhost:54246/Default.aspx]

please help me
Posted
Comments
Andy Lanng 20-Aug-15 7:02am    
post the code / markup on that button.

I know what the issue is, but it would be easier to describe if I could also see where it is
Altaful Haq 20-Aug-15 7:29am    
<ul>
<li class='active'><a href="Default.aspx"><span>User Information</span></li>
<li class='has-sub'><a href="#"><span>Managment</span>
<ul>
<li><span>Order</span></li>
<li class='last'><span>City</span></li>
</ul></li>
</ul>
F-ES Sitecore 20-Aug-15 7:23am    
Master pages aren't "frames", they execute as if they are in the same location as the *content* page so all of the links on that page need to be relative to the content page. Use techniques like Page.ResolveUrl to ensure the links on the master page are always correct no matter what content page is being viewed.

Failing this, just go through any master page tutorial and these things will be covered.

1 solution

As F-ES states: The links will be relative to the link that's open. You can specify root with a "/":

XML
<ul>
<li class='active'><a href="/Default.aspx"><span>User Information</span></li>
<li class='has-sub'><a href="#"><span>Managment</span>
<ul>
<li><span>Order</span></li>
<li class='last'><span>City</span></li>
</ul></li>
</ul>
 
Share this answer
 
Comments
Altaful Haq 20-Aug-15 7:39am    
and some page are in the folder like href = "../pages/order.aspx"
Altaful Haq 20-Aug-15 7:41am    
thanks for helping.. the above question is also solve by href = "/../pages/order.aspx"
Andy Lanng 20-Aug-15 8:11am    
Remember that "/" is relative to the root. /pages/order.aspx will get you where you need. You can not go to that parent of the root because there isn't one
Altaful Haq 21-Aug-15 3:10am    
thanks

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900