...

View Full Version : Connection String Problem



codefantom
01-19-2007, 04:39 AM
The '..' characters are not allowed in the Path parameter for the MapPath method.
/Connections/connportal.asp, line 30

This is line 30
MM_connDUportal_STRING = "DRIVER={Microsoft Access Driver (*.mdb)};DBQ=" & Server.MapPath("..\_private\portal.mdb")
%>

Spudhead
01-19-2007, 12:21 PM
It's usually more helpful if you keep related issues in the same thread (http://www.codingforums.com/showthread.php?t=105413).

You can't mappath a dir outside the server root. The server doesn't know that there are dirs outside its root path.

What you can do is mappath the server root:


serverRoot = server.mappath("/")

and use that to manually construct the path you need, since you know where your _private dir is in relation to the root.

degsy
01-23-2007, 01:56 PM
You need to allow parent paths in IIS.

If you cannot do this then you can create a path using the server-variables


p_path = Request.ServerVariables("APPL_PHYSICAL_PATH")
' c:\domains\d\domain.com\user\htdocs\


'-------------
' Using Split
path = Cstr(p_path)
path = Split(p_path,"\")

For section=0 To Ubound(Path)-2
root = root & Path(section) & "\"
Next
' c:\domains\d\domain.com\user\
'-------------

'-------------
' Using string functions
root = Mid(p_path,1,InStrRev(p_path,"\",InStrRev(p_path,"\")-1))
' c:\domains\d\domain.com\user\
'-------------

db = root & database
' c:\domains\d\domain.com\user\data\pw.mdb



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum