Not a valid path

I have an aspx web page that connects to an Access database through an ASP.NET connection string. The code works perfectly when I preview the page on my local machine. But I get this error when I publish the web site to a Windows server at my hosting company:

'M:\Webs\2008 Webs\MSA Points\msa_web.mdb' is not a valid path. Make sure that the path name is spelled correctly and that you are connected to the server on which the file resides.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Data.OleDb.OleDbException: 'M:\Webs\2008 Webs\MSA Points\msa_web.mdb' is not a valid path. Make sure that the path name is spelled correctly and that you are connected to the server on which the file resides.

1 answer

Dear Frank,

it's very simple. The path to the Access Database File (mdb) has to be accessible from the web server and be named accordingly. You probably have mapped the path with the M: drive letter on your machine. So you´ll have to do the same mapping on the web server, i e, assign a drive letter M:.

But the best solution is to use the full network path to the file on your connection string, so it will be valid for all machines in your network.

Making it short: replace the "M:" drive designation with it's the path it is assigned to, e.g. \servername\sharedfoldername\