Solved

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

Posted on 2006-11-30
7
602 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 69

Accepted Solution

by:
Éric Moreau earned 500 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
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
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 69

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

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
EvenOdd challenge 10 83
thread-safe code in c++ 2 72
scoresClump  challenge 31 108
how to send memory stream from ics Client To ics server ? 11 54
Purpose To explain how to place a textual stamp on a PDF document.  This is commonly referred to as an annotation, or possibly a watermark, but a watermark is generally different in that it is somewhat translucent.  Watermark’s may be text or graph…
Whether you’re a college noob or a soon-to-be pro, these tips are sure to help you in your journey to becoming a programming ninja and stand out from the crowd.
An introduction to basic programming syntax in Java by creating a simple program. Viewers can follow the tutorial as they create their first class in Java. Definitions and explanations about each element are given to help prepare viewers for future …
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…

746 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now