ASP.NET 2.0 With DLL config files Shadow Copy Question

  • Thread starter mark_overstreet
  • Start date
M

mark_overstreet

I have a generic data layer DLL that expects to read its connection
string from it's own config file. The dll and config file have been
placed in the bin directory (VS.NET2005). However, due to shadow
copying, the config file does not get placed in the same directory as
the executing assembly at execution time.

For example, my data access DLL was copied to the following location
....

C:\\WINNT\\Microsoft.NET\\Framework\\v2.0.50727\\Temporary ASP.NET
Files\\labor.helpdesk.website\\3911f8af\\6fcbc95c\\assembly\\dl3\\5c476dff\\8c8190b6_9402c701\\Labor.Helpdesk.DataLayer.DLL

.... but the config file appears in the shadow copy bin directory here

C:\WINNT\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET
Files\labor.helpdesk.website\3911f8af\_shadow\6fcbc95c\bin\17

So my question is how can I ready the .config file from my data access
DLL (Labor.Helpdesk.DataLayer.DLL) if the files are in two physical
locations?

Thanks
Mark
 
G

Guest

This is really not a C# language group question but rather an asp.net group
question. However, if you keep your config file in the root of the web app,
wny can't you do something like

System.Web.HttpContext.Current.Server.MapPath("myconfig.xml");

Peter
 
M

mark_overstreet

Sorry for posting this in the wrong group but thanks for the response.
I can't do this because ...

1) It is a generic DLL that may be used with any type of project
including a Winforms so I may not have access to an HTTPContext object.

2) The DLL currently expects to load the config file from the same
directory the DLL is located and I'd like for that to continue to work
across project types (Winforms, Web, etc)

Any other ideas or do I need to take this to the ASP.NET group?

Thanks again.

Mark
 
G

Guest

The original will be in:
AppDomain.CurrentDomain.SetupInformation.PrivateBinPath
or
AppDomain.CurrentDomain.SetupInformation.ApplicationBase

Test for the right one first, then use that in your code.


HTH

Ciaran O'Donnell
 

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