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?

Improve company productivity with a Business Account.Sign Up

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
What Kind of Coding Program is Right for You?

There are many ways to learn to code these days. From coding bootcamps like Flatiron School to online courses to totally free beginner resources. The best way to learn to code depends on many factors, but the most important one is you. See what course is best 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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.