Access connection string problem with Web hosting

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
 
R

Raja Balaji R

Hi,

Use the

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

to find the physical path

Thanks & Regards
Raja Balaji R
 
J

Jerry

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top