1..
Server.MapPath is indifferent on whether you use backslashes or forward slashes. If you do not put a forward or backward slash at the beginning of the string passed into Server.MapPath, the current directory that the ASP page is being executed is used as the base for the physical path. For example, if you had an ASP script running in the Inc directory, which had the physical path C:\InetPub\wwwroot\Inc, the following two lines:
<%= Server.MapPath("somefile.txt") %>
<%= Server.MapPath("/somefile.txt") %>
Would produce different output. The first line would use the current directory's physical path as the path for somefile.txt, and would output C:\InetPub\wwwroot\Inc\somefile.txt. The second line of code, due to the beginning forward slash, would use the root physical path, producing C:\InetPub\wwwroot\somefile.txt as the output.
2..
Whats wrong with having two connection strings?
having a global.inc (or what ever you wish to call it) is a very handy file to hold connection strings, constants, dim commonly used variables, set mail constants etc.. This way you just comment one conn string out and uncomment your local one. As you are probably aware, hosts can often give us a dir structure we wouldt normaly use localy - why change to suit them. An example of how I use this file:
'live
'const URLBase = "http://www.someAddress.com/labfit/"
'local
const URLBase = "http://localhost/labfit/"
'local
Set Conn = Server.CreateObject("ADODB.Connection")
Conn.open "DRIVER={Microsoft Access Driver (*.mdb)};DBQ=C:\Inetpub\wwwroot\labfit\DB\dbName.m db"
'live
'Conn.open "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("../DB/dbName.mdb")
By using this method you change one file to make dramatic functional changes to your site. If you have your connection string in the head of every page that requires it, remove it, replace it with an include to a global file. If you replicate hosts dir structures every site you do, whats your local file system going to look like after you have built 50 web sites hosted by six different companys all using different dir set ups.
is your 'sprocks' folder inside your 'incs' folder? If so your "../../user-data/pics" path to your pics does not look correct
However, "../user-data/pics/" does, as you said wierd...
Wind is your friend
Matt
|