Relative path reference in WebConfig.ConnectionString

Posted by Ngu Soon Hui on Stack Overflow See other posts from Stack Overflow or by Ngu Soon Hui
Published on 2008-09-24T02:56:04Z Indexed on 2010/03/26 9:33 UTC
Read the original article Hit count: 558

Filed under:
|

Is it possible to specify a relative path reference in connectionstring, attachDbFileName property in a web.config?

For example, In my database is located in the App_data folder, I can easily specify the AttachDBFilename as|DataDirectory|\mydb.mdf and the |Datadirectory| will automatically resolve to the correct path.

Now, suppose that web.config file is located in A folder, but the database is located in B\App_data folder, where A and B folder is located in the same folder. Is there anyway to use relative path reference to resolve to the correct path?

© Stack Overflow or respective owner

Related posts about c#

Related posts about sql-server