Programmaticaly edit web.config

G

Guest

I want to edit a web.confgi file Programmaticaly. I can´t use the
System.Configuration.ConfigurationSettings.AppSettings.Add
becuase the web.config file i want to edit does belongs to another web site.

I have no problems open the web.config-file as stream or XMLDocument.Load,
but as sone as I try to save web.config it says "cannot save.. because the
file is used by another process" or something like that. I guess that the IIS
is "holding" the file.
Though when you open web.config in Notepad and save it works fine.

What´s the difference between the two way?

Regards Erik Juhlin
 
K

Kevin Spencer

When a .Net application uses a config file, it locks it, preventing it from
being changed. This behavior will change in .Net 2.0 for some types of
configuration elements.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
Paranoia is just a state of mind.
 
G

Guest

But why does it work with Notepad? Can I do some
Win32 API complicated stuff to make it work?
 

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,582
Members
45,062
Latest member
OrderKetozenseACV

Latest Threads

Top