Access connection string problem with Web hosting

  • Thread starter Thread starter Göran Wester
  • Start date Start date
G

Göran Wester

Hi All

I am developing an application using ASP.NET and Access as its database.
THis will run with a web hosting company.

I have no problem with the connection string in my development environment.
I.e I know the physical Path to the mdb file.

Once I shall deploy to the hosting provider I only know that my database
will sit in my http://www.myweb.com/_Private/MyDB.mdb

In old VB6 I could have written:
MyDBPath = app.path & "_private\MyDB.mdb"

I have been touring the namespaces for the better part of the day, but have
failed to find a property or method that gives me the path to my web root
directory that I can use for my connection string.

Does anyone know?

Thanks in advance
Göran Wester
 
Hi,

Use the

Request.ServerVariables("APPL_PHYSICAL_PATH")
Or
Server.MapPath(path)

to find the physical path

Thanks & Regards
Raja Balaji R
 
How about using MAPPath

Pete Wright said:
Or even better yet, make use of the web.config file in your project to store
the database name and location in there. You can then access it with
System.Configuration.ConfigurationSettings.AppSettings

Hope that helps
--
Peter Wright
Author of ADO.NET Novice To Pro, from Apress Inc.


_____________________________
Hi,

Use the

Request.ServerVariables("APPL_PHYSICAL_PATH")
Or
Server.MapPath(path)

to find the physical path

Thanks & Regards
Raja Balaji R
 
Back
Top