Programmatically finding machine.config

  • Thread starter Thread starter Kevin Jackson
  • Start date Start date
K

Kevin Jackson

Is there a .NET framework call(s) or technique that allows one to
programmatically find the machine.config file.
 
There's no public API in v1.x for reading/writing any config file (other
than resorting to an XMl parser). In v2.0 they've reworked the configuration
plumbing and now have APIs for reading and writing as well as other things
like encrypting sections of the config file (think connection strings).

-Brock
DevelopMentor
http://staff.develop.com/ballen
 
See:
http://msdn.microsoft.com/library/d...ystemreflectionassemblyclasslocationtopic.asp

You could try to pass the name of a.NET assembly
to System.Reflection.Assembly.Location, and
concatenate "/config/machine.config" to the path returned.

In .NET 2.0, you can do a few things, natively, with that info.

In .NET 1.x you can't do anything, natively, with that info,
although you could manipulate the file, something I'd be very
wary about doing, since a screw-up will cost you a lot.

You should create web.config entries which override any
machine-wide settings you want changed, if that's your goal.




Juan T. Llibre
ASP.NET MVP
http://asp.net.do/foros/
Foros de ASP.NET en Español
Ven, y hablemos de ASP.NET...
======================
 
Back
Top