Sign In| Join
Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Nov 28, 2011 08:31 AM by Ruchira
Member
385 Points
257 Posts
Nov 27, 2011 06:56 PM|LINK
i used a snippet of code from internet it resulted in the next web.config appsettings . another snipped of code only added the setting
Sub config() Dim conf As Configuration = System.Web.Configuration.WebConfigurationManager.OpenWebConfiguration("~") Dim myAdminKeyVal As KeyValueConfigurationElement myAdminKeyVal = New KeyValueConfigurationElement("myAdminTool", "admin.aspx") conf.AppSettings.Settings.Add(myAdminKeyVal) conf.Save(System.Configuration.ConfigurationSaveMode.Modified) End Sub the web config: <appSettings> <remove key="myAdminTool" /> <add key="myAdminTool" value="admin.aspx,admin.aspx,admin.aspx" /> <add key="NewKey0" value="vrijdag 25 november 2011 11:26:43" /> <add key="NewKey1" value="vrijdag 25 november 2011 11:26:50" /> <add key="NewKey2" value="vrijdag 25 november 2011 11:30:30" /> <add key="NewKey3" value="vrijdag 25 november 2011 11:31:31" /> <add key="NewKey5" value="vrijdag 25 november 2011 13:53:15" /> <add key="NewKey6" value="vrijdag 25 november 2011 14:30:01" /> <add key="NewKey7" value="vrijdag 25 november 2011 14:30:10" /> </appSettings>
All-Star
17361 Points
3059 Posts
Nov 27, 2011 09:43 PM|LINK
wetlip /
back slash indicates end of that particular configuration, in your case each key.
Let us know further queries.
Nov 28, 2011 08:22 AM|LINK
i mean , i understand the code add the element < add key="myadmintool" etc / > but why also the eleement <remove key "admintools" />
is that to remove all other keys with the attribute "admintools" preceding this remove key ?
44410 Points
7196 Posts
MVP
Nov 28, 2011 08:31 AM|LINK
wetlip <remove key="myAdminTool" />
It will remove all the previouse values for the 'myAdmingTool" key before assigning the new values. Kind of a reset thing.
Please 'Mark as Answer' if this post helps you.
wetlip
Member
385 Points
257 Posts
why is " remove key="myAdminTool" / " added while adding key to webconfig
Nov 27, 2011 06:56 PM|LINK
i used a snippet of code from internet it resulted in the next web.config appsettings . another snipped of code only added the setting
Sub config() Dim conf As Configuration = System.Web.Configuration.WebConfigurationManager.OpenWebConfiguration("~") Dim myAdminKeyVal As KeyValueConfigurationElement myAdminKeyVal = New KeyValueConfigurationElement("myAdminTool", "admin.aspx") conf.AppSettings.Settings.Add(myAdminKeyVal) conf.Save(System.Configuration.ConfigurationSaveMode.Modified) End Sub the web config: <appSettings> <remove key="myAdminTool" /> <add key="myAdminTool" value="admin.aspx,admin.aspx,admin.aspx" /> <add key="NewKey0" value="vrijdag 25 november 2011 11:26:43" /> <add key="NewKey1" value="vrijdag 25 november 2011 11:26:50" /> <add key="NewKey2" value="vrijdag 25 november 2011 11:30:30" /> <add key="NewKey3" value="vrijdag 25 november 2011 11:31:31" /> <add key="NewKey5" value="vrijdag 25 november 2011 13:53:15" /> <add key="NewKey6" value="vrijdag 25 november 2011 14:30:01" /> <add key="NewKey7" value="vrijdag 25 november 2011 14:30:10" /> </appSettings>sukumarraju
All-Star
17361 Points
3059 Posts
Re: why is " remove key="myAdminTool" / " added while adding key to webconfig
Nov 27, 2011 09:43 PM|LINK
back slash indicates end of that particular configuration, in your case each key.
Let us know further queries.
Application Architecture Guide 2.0
My Blog
Twitter
wetlip
Member
385 Points
257 Posts
Re: why is " remove key="myAdminTool" / " added while adding key to webconfig
Nov 28, 2011 08:22 AM|LINK
i mean , i understand the code add the element < add key="myadmintool" etc / > but why also the eleement <remove key "admintools" />
is that to remove all other keys with the attribute "admintools" preceding this remove key ?
Ruchira
All-Star
44410 Points
7196 Posts
MVP
Re: why is " remove key="myAdminTool" / " added while adding key to webconfig
Nov 28, 2011 08:31 AM|LINK
It will remove all the previouse values for the 'myAdmingTool" key before assigning the new values. Kind of a reset thing.
My Tech blog | My YouTube ChannelPlease 'Mark as Answer' if this post helps you.