I'm new at ASP, and I'm trying to code with a simple tree to organize my code. It is as follows:
-act
connect.asp
login.asp
-db
database.sql
-img
images.files
-style
styles.css
-view
index.asp
For now, on training's sake, my index.asp is a login page, that calls login.asp to actually login the user. Then, that login.asp redirects him back to Index.asp. I am calling the login.asp
just fine from my index.asp
, because I use HTML to reference it:
<form action="act/login.asp" method="post">
But I can't call index.asp
from my login.asp
. I have tried
response.redirect(Server.MapPath("../index.asp"))
But as I read about MapPath, it does not accept ../
and when I just Server.MapPath("/")
it references the current folder.
How can I navigate through my folders using ASP? I have nothing accept MapPath and it does't work with parent folders.
When you use MapPath
it returns a local physical path, and redirect("url")
wants a URL to redirect you to. Now, ../
does not work in ASP. So, what you can do is:
responde.redirect("/parentdirectory/index.asp")
Note that If you use the same code only with "/index.asp"
it won't work, since "/"
brings you to the root of the project.