about App.config file access premission

  • Thread starter Thread starter pei_world
  • Start date Start date
P

pei_world

hi there,
I want to know if it is possible to write some data to App.config file at
runtime.
I did try, but it said read-only, how can I get rid of it
 
pei_world,

You can write to it, assuming you have the appropriate permissions.
However, it might be in use by the .NET runtime, and I am not sure what the
policy is on that (if it is loaded once for some reason, if a lock is held
on it, etc, etc).

However, why would you want to get rid of the app.config file? If you
want to edit it, you can use the classes in the System.Xml namespace to do
so, as it is just an XML file.

Hope this helps.
 
The Configuration Management Application Block can do this too, so you wont
have to write your own code to accomplish this:
http://msdn.microsoft.com/library/en-us/dnbda/html/cmab.asp
Summary: The use of standard .NET configuration files (both computer- and
application-based) provides read-only access to application configuration
data stored in XML files - an approach that is too restrictive for many
applications. The Configuration Management Application Block provides a
simple and efficient solution to overcome these limitations, allowing you to
read and write application configuration data securely, regardless of its
in-memory structure or the physical location and type of data store.

--
Greetz

Jan Tielens
________________________________
Read my weblog: http://weblogs.asp.net/jan


Nicholas Paldino said:
pei_world,

You can write to it, assuming you have the appropriate permissions.
However, it might be in use by the .NET runtime, and I am not sure what the
policy is on that (if it is loaded once for some reason, if a lock is held
on it, etc, etc).

However, why would you want to get rid of the app.config file? If you
want to edit it, you can use the classes in the System.Xml namespace to do
so, as it is just an XML file.

Hope this helps.


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)


pei_world said:
hi there,
I want to know if it is possible to write some data to App.config file at
runtime.
I did try, but it said read-only, how can I get rid of it
 
Back
Top