Click here to Skip to main content
15,913,027 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi All,

Created Menu using html Un ordered list,

Using Href : one list item redirecting to one web form in A folder.

Second list item redirecting to another web form in B folder.

For the first list item navigating perfectly,

but when clicking on the second list item , it is searching for the file from A Folder, Rather searching in B Folder,

Please suggest me in solving this,

Thanks in advance.

What I have tried:

  • < href="A/Webform1.aspx"> Sample1
  • < href="B/Webform2.aspx"> Sample2
  • Posted
    Updated 12-Jul-16 2:59am
    v3

    1 solution

    You're specifying a relative URL. This will be relative to the current page. If you're in the root of your site, both links will be correct. But if you're on a page in the A folder, both links will be wrong, as they'll resolve to /A/A/Webform1.aspx and /A/B/Webform2.aspx.

    Add runat="server" to the <a> tags, and use app-relative paths:
    ASP.NET
    <a runat="server" href="~/A/Webform1.aspx">Sample 1</a>
    <a runat="server" href="~/B/Webform2.aspx">Sample 2</a>

    That way, ASP.NET will resolve the links relative to the root of your application, and will output the correct link for you.
     
    Share this answer
     

    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