PDA

View Full Version : How to use Server.MapPath


bonnie
06-12-03, 12:23 AM
I can only open the webpages through the FrontPage. I cannot know the physical path, and I want to put the Access database through the FrontPage. How can I connect this Access database? May I use Server.MapPath? If yes, how can I use it?:( :confused:

Tesco
06-12-03, 05:15 AM
Server.Mappath() translates a Virutal path , into a Physical path.

So, if your database was in a directory called 'db' your code would look like:
Server.MapPath("db/myDatabase.mdb")

hth :)

Stealth
06-12-03, 12:07 PM
Or, to find out the physical path used.


<%
response.write request.ServerVariables("APPL_PHYSICAL_PATH")
%>

bonnie
06-12-03, 10:59 PM
I'm the beginner of ASP, so would you pls explain it in details?:confused:
Thanks a lot!!

Stealth
06-16-03, 02:04 PM
request.ServerVariables("APPL_PHYSICAL_PATH") will return the physical path.

Physical being C:\website\files\
Virtual is the path from the current folder.
So if your file is in C:\website\ then the virtual (mappath) to access a database in C:\website\files\ is server.mappath("files/database.mdb")


hth

Stealth

bonnie
06-17-03, 03:31 AM
Thanks!!:D