Link to home
Start Free TrialLog in
Avatar of kenashton
kenashton

asked on

Confused Newbie - Server.Mappath() in global.asa

Have 3 web sites (shared IP) with a common  /database folder outside the 3 website paths -

c:\websites\MySites\database
c:\websites\MySites\mysite1.com
c:\websites\MySites\mysite2.com
c:\websites\MySites\mysite3.com

My original global.asa connection string 'folder' term was  

(1)  Server.mappath(../database/MyDb.mdb)

This returns the correct absolute path    

(2) c:\websites\MySites\database\MyDb.mdb     - - - - - - -     SOMETIMES!!!

After two weeks of normal operation, all DB reliant pages stopped working,
investigation showed that the server.mappath function was returning

(3)  C:\websites\MySites\mysite1.com\MySites\database\MyDb.mdb

as if there were a virtual duplicate of the /MySites/database/ part also existing on
.../MySite1   .../MySite2 and .../MySite3 folders.



Temporarily, I have placed the absolute path directly in global.asa.  If I put the
original path (1) back in global.asa, everything works for a few days and then stops.
If I catch it at the right moment, a test script definitely reveals that mappath is returning
(3), when things stop working, so I cannot rely upon it.

Bit of a newbie, so I am pretty confused, especially when my test script for mappath
does not return what I expected -

Test 1
(1)  Server.mappath(../database/MyDb.mdb)
returns
(2) c:\websites\MySites\database\MyDb.mdb - SOMETIMES!!!

Test 2
(4)  Server.mappath(/database/MyDb.mdb)
returns
(5)  C:\websites\MySites\mysite1.com\MySites\database\MyDb.mdb  

Test 3
(6)  Server.mappath(/MySites/database/MyDb.mdb)
returns
(7) C:\websites\MySites\mysite1.com\MySites\database\MyDb.mdb

I am convinced there must be something amiss with my ISP's virtual folder settings. They have been very good, but I think they to are equally perplexed with what is going on.

I hope I have given sufficient info, (5) and (7) really confuse me any help and advice will be
most gratefully appreciated.

Kenny
ASKER CERTIFIED SOLUTION
Avatar of rama_krishna580
rama_krishna580
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of kenashton
kenashton

ASKER

Hi rama

Thanks for your advice. I am still struggling, but have discovered what is going on, but not why - when server.mappath is in global.asa, it is returning a different path value to when the same statement is 'outside' global.asa, ie on another page, but at the same root folder level as global.asa - when i figure out how to give you the points, will do
Thanks again
thanks for accepting and i will look forward to help you in future..
best of luck..

R.K