Writing to web.config

sodo84

New Member
I want to be able to edit the appSettings key/value pairs in the web.config file from my app. I worked out how to read the values with<BR>XmlTextReader reader=null;<BR>reader=new XmlTextReader(strPath);<BR>reader.WhitespaceHandling= WhitespaceHandling.None;<BR>while (reader.Read())<BR>{<BR>Response.Write(reader.Name);<BR>{<BR>if(reader.HasAttributes)<BR>{<BR>if(reader.GetAttribute(0).ToString()=="MainText")<BR>{<BR>Response.Write(reader.GetAttribute("value").ToString());<BR><BR>etc<BR>which reads the value for the key "MainText", but how do I edit the value and save the file?<BR>thanks<BR>I dont think you should be using the web.config file for what you want to acomplish.<BR><BR>The web.config file should be set and left alone.<BR><BR>Try using another file or an internal object to acomplish want you want.You can always use the application object or the hash table object to get the same effect.
 
Back
Top