Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

mapPath problem 1

Status
Not open for further replies.

JohnBeton

Programmer
Feb 9, 2004
21
BE
hello

i'm building a website that has a database bel.mdb in:

now i'm working on an asp-file that has to access bel.mdb, this asp-file is located at:

what should the correct Server.mapPath-statement be ?
i thought: Server.mapPath("/database/bel.mdb"), but when i do that, he's looking for: /tracking/database/bel.mdb

he should go one step further to the root, not the tracking-dir...

can someone help me ?
thanks already
 
To be honest, i dont know...
i test my asp files online, since i only have to make some adaptations...
have no idea wich version of iis my host has...
 
I've had some path problems with IIS 6.0. Anyway your code should do what you expect.
Also you should try one of these

Server.mapPath("./database/bel.mdb")
Server.mapPath("../../database/bel.mdb")

Also i think that there could be another problem if your those 2 folders are in separate virtual directoryies.


________
George, M
 
none of the two suggestions work...

but thx anyway

someone else with other suggestions ?
 
That is the only sugestion you can have for the moment cuz that should work.

You can try also to Response.Write sorts of MapPath and see the diference.

Response.Write Server.mapPath("./database/bel.mdb")
Response.Write Server.mapPath("../../database/bel.mdb")
Response.Write Server.mapPath("database/bel.mdb")
Response.Write Server.mapPath("/database/bel.mdb")

Also if this doesnt looks ok then you should move your database inside your tracking folder and tesh that from there.




________
George, M
 
well, thats the problem in fact...

at the moment, the database is in the same folder as the .asp file. this works, but is not very good, since the db is downloadable,
the database folder in the root is a hidden folder, and not accessible to unauthorized users...
thats why i want to move it there

maybe it is hidden for the asp-code as well ?
u have any experience with this ?
 
That's the problem then if the page is hiden from the web users then it's hidden from the IIS as well as far as i knw.
Try to use an direct access to the file like
c:\database\bel.mdb and this way your database is out of the folder.

________
George, M
 
shaddow is correct.
I had the same problem with IIS 6 and the only way you can connect to DB located above the is to use absolute path like D:domain/db/your.mdb
With IIS 5 you can use MapPath with "../"
 
In IIS 6.0 you might try ticking the Enable Parent Paths in the configuration for the web applications.

--------------------------------------
"We are star-stuff. We are the universe made manifest trying to figure itself out."
-- Delenn in Babylon 5 - "A Distant Star"
 
It looks like Enable Parent Paths will do the trick.
I was enabling all other features but that one i've been missing it.
Nice tip Spider

________
George, M
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top