PC Review


Reply
Thread Tools Rate Thread

ConfigurationManager RefreshSection not "refreshing"

 
 
roundcrisis
Guest
Posts: n/a
 
      14th Nov 2007
HI there:


I have to modify the value of an item in appSettings

ConfigurationManager.AppSettings["somekey"] = somevalue;
ConfigurationManager.RefreshSection("appSettings");

however the value is nto refreshed, any ideas?

 
Reply With Quote
 
 
 
 
=?Utf-8?B?UGV0ZXIgQnJvbWJlcmcgW0MjIE1WUF0=?=
Guest
Posts: n/a
 
      14th Nov 2007
RefreshSection refreshes so that the next time the configuration is read it
will read from the disk instead of Cache. However, you still need to read it:

The GetSection method accesses run-time configuration information that it
cannot change. To change the configuration, you use the GetSection method on
the configuration file you obtain by using one of the following Open methods:

OpenExeConfiguration

OpenMachineConfiguration

OpenMappedExeConfiguration

OpenMappedExeConfiguration


--
--Peter
http://www.eggheadcafe.com
unBlog: http://petesbloggerama.blogspot.com
BlogMetaFinder: http://www.blogmetafinder.com



"roundcrisis" wrote:

> HI there:
>
>
> I have to modify the value of an item in appSettings
>
> ConfigurationManager.AppSettings["somekey"] = somevalue;
> ConfigurationManager.RefreshSection("appSettings");
>
> however the value is nto refreshed, any ideas?
>
>

 
Reply With Quote
 
roundcrisis
Guest
Posts: n/a
 
      15th Nov 2007
On Nov 14, 7:24 pm, Peter Bromberg [C# MVP]
<pbromb...@yahoo.NoSpamMaam.com> wrote:
> RefreshSection refreshes so that the next time the configuration is read it
> will read from the disk instead of Cache. However, you still need to read it:
>
> The GetSection method accesses run-time configuration information that it
> cannot change. To change the configuration, you use the GetSection method on
> the configuration file you obtain by using one of the following Open methods:
>
> OpenExeConfiguration
>
> OpenMachineConfiguration
>
> OpenMappedExeConfiguration
>
> OpenMappedExeConfiguration
>
> --
> --Peterhttp://www.eggheadcafe.com
> unBlog:http://petesbloggerama.blogspot.com
> BlogMetaFinder: http://www.blogmetafinder.com
>
>
>
> "roundcrisis" wrote:
> > HI there:

>
> > I have to modify the value of an item in appSettings

>
> > ConfigurationManager.AppSettings["somekey"] = somevalue;
> > ConfigurationManager.RefreshSection("appSettings");

>
> > however the value is nto refreshed, any ideas?- Hide quoted text -

>
> - Show quoted text -


this worked thanks

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Field Names: "LongName", "ShortName", "Code", "Description","Comments" PeteCresswell Microsoft Access 2 25th Feb 2009 11:41 PM
Editing a .exe.config file with the class "ConfigurationManager" ibel.groups@gmail.com Microsoft Dot NET 1 31st Dec 2008 04:50 PM
ConfigurationManager.AppSettings["NAME"] returns null sandy.82in@gmail.com Microsoft Dot NET 1 3rd Apr 2007 07:46 PM
<FORM METHOD="post" onSubmit="return fieldcheck()" name="orientation" action="http://ws-kitty.BU.edu/AT/survey/orientation/script/write.asp" language="JavaScript"> Joeyej Microsoft ASP .NET 0 4th Jun 2004 08:55 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 09:40 AM.