We help IT Professionals succeed at work.

Is the problem server.mappath or something else?

bigmoxy asked
I'm testing a new .Net application that uses MS Access. I am using server.mappath to obtain the physical path of the file and have confirmed my oleDbConnection string syntax using a test page. Nonetheless when I try to access the db using one of the application pages I get a resource not found error.

I found one newsgroup posting that indicated the folder with the db must have write permissions. If that is correct I am unable to set them via my FTP client. The console displays a command not recognized error.

The location of the db is D:\Domains\zanalysts.com\wwwroot\projects\cargo\currentDB\VinMaster_be.mdb.

test page: http://projects.zanalysts.com/cargo/path.aspx
problem page: http://projects.zanalysts.com/cargo/vehicleDetail.aspx

Thank you!

Here's the test page code:

<%@ Page Language="VB" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<script runat="server">
    Dim dbPath As String = Server.MapPath("currentDB/VinMaster_be.mdb")
    Dim connString As String = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" & _
    dbPath & ";Persist Security Info=False;"


<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>Untitled Page</title>
    <form id="form1" runat="server">

Here's a snippet from the problem page code that uses server.mappath:

        Dim dbPath As String = Server.MapPath("currentDB/VinMaster_be.mdb")
        Dim MyConnection As New OleDbConnection _
            ("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" & dbPath & _
             ";Persist Security Info=False;")
Watch Question

Usually if the web hotel supports Access datbases, there is a special folder in your account where you are supposed to put them. The folder already has write permissions set so that the database file gets the correct permissions when you upload it to the folder.

Explore More ContentExplore courses, solutions, and other research materials related to this topic.