ConfigurationSe ttings.AppSetti ngs allows me to read from my config but how
do I write to my config file?
--
There are 10 kinds of people. Those who understand binary and those who
don't. http://code.acadx.com
(Pull the pin to reply) 16 16451
Frank, ConfigurationS ettings.AppSett ings allows me to read from my config but how do I write to my config file?
Download the TFTP Server eval components from www.abderaware.com and look at the
Configuration class (configuration. cs).
Cya! :-)
--
Abderaware
Fine Components For .NET
Turn on, tune in, download.
zane a@t abderaware.com
Hi Frank,
Writting into .config file is not a good idea.
The config files are intended to give administrators a way to configure
certain settings and not to persist settings.
They reside (normally) under program files folder thus only admin (if not
set otherwise) can edit them.
If you have settings that you need to persist consider storing them in
user-specific or app-specific area.
--
Miha Markic [MVP C#] - RightHand .NET consulting & software development
miha at rthand com www.rthand.com
"Frank Oquendo" <fr****@acadxpi n.com> wrote in message
news:e1******** ******@TK2MSFTN GP10.phx.gbl... ConfigurationSe ttings.AppSetti ngs allows me to read from my config but how do I write to my config file?
On Tue, 10 Feb 2004 08:41:50 +0100, "Miha Markic [MVP C#]" <miha at rthand com>
wrote: The config files are intended to give administrators a way to configure certain settings and not to persist settings. They reside (normally) under program files folder thus only admin (if not set otherwise) can edit them.
What supporting documentation do you have for that statement? I don't mean to
be confrontational , I really am curious to know if I missed some position taken
by MS on that point.
--
Abderaware
Fine Components For .NET
Turn on, tune in, download.
zane a@t abderaware.com
Hi Zane, What supporting documentation do you have for that statement? I don't
mean to be confrontational , I really am curious to know if I missed some position
taken by MS on that point.
For instance, config files are placed into (under) program files folder
where only admins have write access by default.
It is generally not a good idea to allow every user to write into program
files folder.
That is also why MS doesn't support writting to config files.
For that purposes there are other folders (for example ApplicationData ,
CommonApplicati onData, LocalApplicatio nData) - some of them support also
roaming - you can find them by looking at
Environment.Spe cialFolder Enumeration .net help topic.
There you'll find also a useful link with more details on special folders: http://msdn.microsoft.com/library/de...nums/csidl.asp
Sorry, I don't have other better links right now, but AFAIK this is how it
should be.
HTH,
--
Miha Markic [MVP C#] - RightHand .NET consulting & software development
miha at rthand com www.rthand.com
Miha, For instance, config files are placed into (under) program files folder where only admins have write access by default.
Whether Frank is developing for such a situation is something we don't know.
That is also why MS doesn't support writting to config files. For that purposes there are other folders (for example ApplicationData , CommonApplicat ionData, LocalApplicatio nData) - some of them support also roaming - you can find them by looking at Environment.Sp ecialFolder Enumeration .net help topic.
Or, one can simply use a configuration file in the application's directory.
From MSDN:
<q>
The name and location of the application configuration file depend on the
application's host, which can be one of the following:
Executable–host ed application.
The configuration file for an application hosted by the executable host is in
the same directory as the application. The name of the configuration file is the
name of the application with a .config extension. For example, an application
called myApp.exe can be associated with a configuration file called
myApp.exe.confi g.
</q>
ms-help://MS.VSCC/MS.MSDNVS/cpguide/html/cpconapplicatio nconfigurationf iles.htm
Sorry, I don't have other better links right now ...
Well, until you find some better links ... :-)
--
Abderaware
Fine Components For .NET
Turn on, tune in, download.
zane a@t abderaware.com
What about on installation? I have on several occasions had an installation
class write to the App.Config. I create a DataSet, then read the App.Config
with ReadXml() . The installer class then updates the Data Set and then
calls WriteXml method of the data set.
I would agree that you should avoid using .config files for most things, but
they seem a natural for things you would otherwise use the registry for.
Else why would they have the appSettings section?
"Miha Markic [MVP C#]" <miha at rthand com> wrote in message
news:ux******** ******@TK2MSFTN GP09.phx.gbl... Hi Frank,
Writting into .config file is not a good idea. The config files are intended to give administrators a way to configure certain settings and not to persist settings. They reside (normally) under program files folder thus only admin (if not set otherwise) can edit them.
If you have settings that you need to persist consider storing them in user-specific or app-specific area.
-- Miha Markic [MVP C#] - RightHand .NET consulting & software development miha at rthand com www.rthand.com
"Frank Oquendo" <fr****@acadxpi n.com> wrote in message news:e1******** ******@TK2MSFTN GP10.phx.gbl... ConfigurationSe ttings.AppSetti ngs allows me to read from my config but
how do I write to my config file?
On Tue, 10 Feb 2004 11:58:18 -0700, "John Smith" <jb****@blackfo ot.com> wrote: Else why would they have the appSettings section?
Bingo! :-)
--
Abderaware
Fine Components For .NET
Turn on, tune in, download.
zane a@t abderaware.com
<zane (_) abderaware.com (Zane Thomas)> wrote in message
news:40******** *******@news.mi crosoft.com... Miha,
For instance, config files are placed into (under) program files folder where only admins have write access by default. Whether Frank is developing for such a situation is something we don't
know.
Yes, we don't know. I was talking about common scenarios. That is also why MS doesn't support writting to config files. For that purposes there are other folders (for example ApplicationData , CommonApplicat ionData, LocalApplicatio nData) - some of them support also roaming - you can find them by looking at Environment.Sp ecialFolder Enumeration .net help topic. Or, one can simply use a configuration file in the application's
directory. From MSDN:
<q> The name and location of the application configuration file depend on the application's host, which can be one of the following:
Executable-hosted application. The configuration file for an application hosted by the executable host is
in the same directory as the application. The name of the configuration file
is the name of the application with a .config extension. For example, an
application called myApp.exe can be associated with a configuration file called myApp.exe.confi g. </q>
ms-help://MS.VSCC/MS.MSDNVS/cpguide/html/cpconapplicatio nconfigurationf iles.
htm
Configuration file - not persistent storage file. Sorry, I don't have other better links right now ...
Well, until you find some better links ... :-)
Do I need them? ;-)
--
Miha Markic [MVP C#] - RightHand .NET consulting & development
miha at rthand com www.rthand.com
"John Smith" <jb****@blackfo ot.com> wrote in message
news:uc******** ******@TK2MSFTN GP09.phx.gbl... What about on installation?
Yes, what about it?
I have on several occasions had an installation class write to the App.Config. I create a DataSet, then read the
App.Config with ReadXml() . The installer class then updates the Data Set and then calls WriteXml method of the data set. I would agree that you should avoid using .config files for most things,
but they seem a natural for things you would otherwise use the registry for. Else why would they have the appSettings section?
Installation is done under administrator account and have privilege and
right to write into config.
It makes sense to create or modify config file at installation time.
However, they are not intended to be used for storing persistent data from
the application itself, like for example windows position - stuff like that.
Sorry if I was not clear enough on this.
--
Miha Markic [MVP C#] - RightHand .NET consulting & development
miha at rthand com www.rthand.com This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: msnews.microsoft.com |
last post by:
Hi all,
I was trying to find an easy way to write in the standard configuration
(like app.config) xml-based files. I found classes that can be used to read
this information (in System.Configuration) like the
ConfigurationSettings.AppSettings property, but I was not able to find
anything to write app settings in these files. Isn't this kind of
"asymmetrical"? Anyone familiar with the reasons of such a lack?
Thanks a lot,
|
by: UJ |
last post by:
Is there a way to write into the .config file? In other words treat it like
a .ini file. (I may be confused on what the exact nature of the .config file
may be.)
I can read from it fine but would also like to be able to write to it.
TIA - Jeff.
|
by: MK |
last post by:
Is there any way to write into the app config at runtime?
I want to store position, height and width of my forms.
|
by: Steve |
last post by:
Can anyone tell me the preferred method for writing and
retrieving persistent information using .Net.
Specifically, I am referring to information that you used
to see in registry keys or .ini files like the name of a
database or connection string.
I have read several articles indicating that .config files
are now used, but I am confused because they are read-
only. If I want to write information from within the
application (When a...
|
by: Noozer |
last post by:
I need to keep my application settings in a file that users can
copy/backup/etc.
Before I start using the old INI file standard, is there any easy way to use
XML files to hold application settings?
What is the standard method of saving user settings for VB.Net apps?
| |
by: ROO |
last post by:
Hi Everyone,
I need some help Creating Database Connection at
runtime and writing Connection String to App.Config, I have 3mxtboxes on a
form
txtUsername = SQL admin User
txtPassword = Sql admin password
txtServername = Sql Server name
I want to be able to write the input supplied by users to the App.config
file..
|
by: WT |
last post by:
Hello,
I am writing a Web install project and I want to get the connection string
from user and write it in the web.config of the installed web site.
As the Websetup is a windows program, I use a windows program to get the
string and I don't know if I can use the WebConfigurationManager API to read
and write my web config from a windows program.
What is the prefered .NET 2 way to handle this necessary install problem
without asking...
|
by: Peted |
last post by:
Hi,
im wanting to store some custom text strings in the app.config file of
a c# app, to be retreived and updated when the app runs.
using c# 2005 express
in my testing i am using the code bellow, and its almost idenictal to
every web example i have found. They all suggest the values and file
can be read from and updated. The code bellow runs, with no errors of
|
by: parshupooja |
last post by:
Hey All,
I have old vb.net application and I have various users for that.where I have XML file as datasource.
Till now for each user application was installed seperately.
only difference between these application was xml datasource tag in web.config such as:
Application 1
<appSettings>
<add key="DataFileName" value="Abc.XML" />
</appSettings>
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
| |
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |