I have been fighting with links on my site. I have a root directory with my default.aspx page and my login.aspx page. I then have a /store file with all the rest of my pages save a few which are in their own directories. I have a /about directory and a /faq
directory. I have a button that does this:
Response.Redirect("../ShoppingCart.aspx")
ShoppingCart.aspx is in my /store directory, so usually this redirects fine. However whenever I'm on any other page and click this button (it's a master page button) I get this error:
Cannot use a leading .. to exit above the top directory. Obviously it says this because it can't search through the sub-directories (namely shop) when I set it to ../ but i'd like it to. I just don't know how. Can I get help?
MtheK
Member
133 Points
51 Posts
Cannot use a leading .. to exit above the top directory
Sep 01, 2011 12:55 AM|LINK
I have been fighting with links on my site. I have a root directory with my default.aspx page and my login.aspx page. I then have a /store file with all the rest of my pages save a few which are in their own directories. I have a /about directory and a /faq directory. I have a button that does this:
Response.Redirect("../ShoppingCart.aspx")
ShoppingCart.aspx is in my /store directory, so usually this redirects fine. However whenever I'm on any other page and click this button (it's a master page button) I get this error:
Cannot use a leading .. to exit above the top directory. Obviously it says this because it can't search through the sub-directories (namely shop) when I set it to ../ but i'd like it to. I just don't know how. Can I get help?
Thanks.
PATH .. file Redirect
DarrellNorto...
All-Star
86773 Points
9643 Posts
Moderator
MVP
Re: Cannot use a leading .. to exit above the top directory
Sep 01, 2011 01:49 AM|LINK
How about Response.Redirect("~/store/ShoppingCart.aspx")
PATH .. file Redirect
Darrell Norton's Blog
Please click "Mark as Answer" if this helped you.
MtheK
Member
133 Points
51 Posts
Re: Cannot use a leading .. to exit above the top directory
Sep 03, 2011 02:48 AM|LINK
SWEET IT WORKED!
I see how that works now. I never understood it. the ~/filename/file points directly to the file in THAT directory. I never understood that.
Thanks, Darrell
PATH .. file Redirect