Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

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

Posted on 2006-11-30
7
Medium Priority
?
612 Views
Last Modified: 2011-04-14
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.......


0
Comment
Question by:winsoftech
  • 3
  • 2
  • 2
7 Comments
 
LVL 70

Accepted Solution

by:
Éric Moreau earned 1000 total points
ID: 18045666
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
 
LVL 2

Expert Comment

by:mekanoo
ID: 18052598
..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
 
LVL 2

Expert Comment

by:mekanoo
ID: 18052685
in c# it looks like this:
            string[] s =ConfigurationSettings.AppSettings.GetValues("Name");
            ConfigurationSettings.AppSettings.Add("NameNew", s[0].ToString());
            ConfigurationSettings.AppSettings.Remove("Name");
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 2

Expert Comment

by:mekanoo
ID: 18052705
ha! i didn't read your question properly -----
0
 
LVL 1

Author Comment

by:winsoftech
ID: 18066419

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

Author Comment

by:winsoftech
ID: 18066556
Hi emoreau,

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

0
 
LVL 70

Expert Comment

by:Éric Moreau
ID: 18067600
You can open your config file in a XML document. See http://www.west-wind.com/presentations/configurationclass/configurationclass.asp
0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you’re thinking to yourself “That description sounds a lot like two people doing the work that one could accomplish,” you’re not alone.
In real business world data are crucial and sometimes data are shared among different information systems. Hence, an agreeable file transfer protocol need to be established.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
Screencast - Getting to Know the Pipeline

926 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question