Programmatically finding machine.config

K

Kevin Jackson

Is there a .NET framework call(s) or technique that allows one to
programmatically find the machine.config file.
 
B

Brock Allen

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).
 
J

Juan T. Llibre

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.
 

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

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top