JackOfPH
asked on
Programmatically edit the app.config
I read in some article in the web, that I can edited the app.config through the use of IConfigurationSectionHandl er.
Can you please explain to me how it works? I am really lost, I can't understand it...
Please, provide me a detailed explanation.
For example....
This line of code will write to the app.config file.
...
This line of code will loop through all the nodes in the app.config file....
....
Did you get what I mean?
Please, I really need your help...
Joseph....
P.S.
Please don't give me some links to visit, because I already tried those and I can't understand it.
Can you please explain to me how it works? I am really lost, I can't understand it...
Please, provide me a detailed explanation.
For example....
This line of code will write to the app.config file.
...
This line of code will loop through all the nodes in the app.config file....
....
Did you get what I mean?
Please, I really need your help...
Joseph....
P.S.
Please don't give me some links to visit, because I already tried those and I can't understand it.
ASKER
Both example does not use IConfigurationSectionHandl er?
You can edit it directly through xml :)
ASKER
Yes, but what I want to do is edit it through IConfigurationSectionHandl er...
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
ok, lets try it your way....
How can I add new element? to the app.config file?
I tried this code but no luck...
How can I add new element? to the app.config file?
I tried this code but no luck...
Public Shared Sub UpdateSetting(ByVal Keyname As String, ByVal keyvalue As String)
Dim xmlDoc As New XmlDocument
xmlDoc.Load(AppDomain.CurrentDomain.SetupInformation.ConfigurationFile)
Dim xmlNode1 As XmlNode = xmlDoc.CreateNode(XmlNodeType.Element, "Joseph", "test")
xmlNode1.InnerText = "Ocena"
xmlDoc.AppendChild(xmlNode1)
xmlDoc.Save(AppDomain.CurrentDomain.SetupInformation.ConfigurationFile)
End Sub
Modifying app.config File
http://www.codeproject.com/KB/dotnet/Change_AppConfig_File.aspx
Runtime Web.config / App.config Editing
http://www.eggheadcafe.com/articles/20030907.asp
Open in new window