Writing to web.config in asp.net 1.1 using appSettings.Set() method

I an using asp.net 1.1 version. I want to change value of a key in appSettings in web.config at runtime using set method of appsettings..

eg

ConfigurationSettings.AppSettings.Set("Name","Value");

How can I do this at runtime?? I dont want to use any XMLAttribute stuff..Can anybody suggest a solution???

Thanks a lot in advance.......


LVL 1
winsoftechAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
Éric MoreauConnect With a Mentor Senior .Net ConsultantCommented:
Hi winsoftech,

In .Net 1.1, this class offers a read-only mode to the config file (2.0 is offering a writing mode). You will need to open the XML file and update it using other method then AppSettings.

Cheers!
0
 
mekanooCommented:
..i would read the value of the key and store it in a suitable variable-
create a new key with the desired name - set its value with the stored value -
and delete the old key...
0
 
mekanooCommented:
in c# it looks like this:
            string[] s =ConfigurationSettings.AppSettings.GetValues("Name");
            ConfigurationSettings.AppSettings.Add("NameNew", s[0].ToString());
            ConfigurationSettings.AppSettings.Remove("Name");
0
The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

 
mekanooCommented:
ha! i didn't read your question properly -----
0
 
winsoftechAuthor Commented:

If web.cofig is read only in 1.1 then what are the other ways to change the values in it??
0
 
winsoftechAuthor Commented:
Hi emoreau,

If web.cofig is read only in 1.1 then what are the other ways to change the values in it??

0
 
Éric MoreauSenior .Net ConsultantCommented:
You can open your config file in a XML document. See http://www.west-wind.com/presentations/configurationclass/configurationclass.asp
0
All Courses

From novice to tech pro — start learning today.