Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New Coder
    Join Date
    Jul 2005
    Posts
    17
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Connection String Problem

    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")
    %>

  • #2
    Senior Coder Spudhead's Avatar
    Join Date
    Jun 2002
    Location
    London, UK
    Posts
    1,856
    Thanks
    8
    Thanked 110 Times in 109 Posts
    It's usually more helpful if you keep related issues in the same thread.

    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:

    Code:
    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.

  • #3
    Senior Coder
    Join Date
    Nov 2002
    Location
    North-East, UK
    Posts
    1,265
    Thanks
    0
    Thanked 0 Times in 0 Posts
    You need to allow parent paths in IIS.

    If you cannot do this then you can create a path using the server-variables
    Code:
    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


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •