Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

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

Posted on 2006-11-30
7
Medium Priority
?
611 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Build and deliver software with DevOps

A digital transformation requires faster time to market, shorter software development lifecycles, and the ability to adapt rapidly to changing customer demands. DevOps provides the solution.

 
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

On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

Question has a verified solution.

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

This is about my first experience with programming Arduino.
Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
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 …
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

721 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