Priyank Patel
Priyank Patel

Reputation: 6996

Unable to access ASP.NET Page inside a folder

I am using ASP.NET/C#.

In my menu I have this li item

<li><a href="/Deposits/DepositsInterest.aspx">Update Deposit Interest</a></li>

But when I try to click on the a tag it just gives me this error

Cannot use a leading .. to exit above the top directory.

Can anyone just point me as to what might be missing here?

Any suggestions are welcome.

Upvotes: 0

Views: 2583

Answers (2)

Martin-Brennan
Martin-Brennan

Reputation: 927

The problem could be caused by the DepositInterest.aspx page that you are navigating to. Are there any javascript/CSS files liked on that page or in the master page? If so you might want to check out that they are linked correctly.

Cannot use a leading .. to exit above the top directory

http://forums.asp.net/t/1019849.aspx

Upvotes: 1

Waqar Janjua
Waqar Janjua

Reputation: 6123

link should starts with tilde which represent root of your site or mention your complete address

<li><a href="~/Deposits/DepositsInterest.aspx" runat="server" >Update Deposit Interest</a></li>
     // or type complete address 
<li><a href="YourSite/Deposits/DepositsInterest.aspx">Update Deposit Interest</a></li>
 //             or use asp.net hyperlink
 <li> <asp:HyperLink id="hl1"                  
              NavigateUrl="~/Deposits/DepositsInterest.aspx"
              Text="Hyperlink"
              Target="_new"
              runat="server"/> </li> 

Updated answer: If you are adding hyperlinks dynamically then add them as:

 MenuItem mi = new MenuItem();
    mi.NavigateUrl = "~/Deposits/DepositsInterest.aspx";
    mi.Text = "MY hyperlink";
    Menu1.Items.Add(mi);
    Menu1.DataBind();

Upvotes: 0

Related Questions