# [web] ASP.NET - Specifying online directories

This topic is 4184 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

I'm trying to connect to a database on my website. It works great locally, but when I post it online, it keeps grabbing the wrong directory. The correct path is "\user\access_db\Catalog.mdb" My host does not tell me what drive letter or anything else that it's under. When I specify that path, it assumes that I must mean "c:\user\access_db\Catalog.mdb" and promptly tells me that it can't find the file. Is there a better way to specify the path? Here's the full exception that it's returning: System.Data.OleDb.OleDbException: 'c:\user\access_db\Catalog.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. And here's the line I'm using to connect to the database:
dbconn = new OleDbConnection(@"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=\user\access_db\Catalog.mdb");



##### Share on other sites

This is how I get a path to my access DB:

 public string DatabasePath    {        get        {            return Server.MapPath("~/db/data.mdb");        }    }

Edo