c# - web.config - read custom section, change attribute and save it -
i'm trying access specific custom section of web.config file change section attribute value , save it
this config file:
<custom.viewpoint> <!-- ********** repository ********** --> <application type="custom.tablet.readerapplication, custom.tablet"> <content-set> <publications include="periodical" default="ajcli"> </content-set> </application> <!-- ********** security ********** --> <web.authentication enabled="false"> <session persist="true" expiration="30.00:00:00" /> </web.authentication> <custom.viewpoint>
what i'm trying access web.authentication attribute enable true false , vice versa. want testing purposes, instead of going each folder , changing attribute false want able program when i'm done testing want turn on when done testing.
i found code access section isn't working me. appreciated.
var configuration = webconfigurationmanager.openwebconfiguration("~"); var section = (connectionstringssection)configuration.getsection("connectionstrings"); section.connectionstrings["myconnection"].connectionstring = "data source=..."; configuration.save(); var config = webconfigurationmanager.openwebconfiguration("~/appfolder"); var sectionx = config.getsection("custom.viewpoint"); don't know how access nodes here
Comments
Post a Comment