web.config custom config handler is not flushed

G

Guest

Hi,

I have created a custom Config handler for reading a custom config section
in my .config file(s)
It works very well!

I have placed a web.config in my root directory and then I use sub files in
sub diretories overriding various settings in the config file. Very nice
strategy which really makes it easy to customize generic applications.

One problem makes it all useless though. The settings is cached by ASP.NET
which makes switching app impossible.

So the obvious question is - where can I either flush the cache or disable
it...

thnx in advance /Mads B - Copenhagen Denmark
 
C

Curt_C [MVP]

what's being cached? A value from the web.config?
If you want it reset either restart that app pool, that site, or re-save the
web.config (forces a restart of app).
 
G

Guest

thnx but:

The setup is as follows:
I have a web app running with a web.config file

I have then made some sub directories (/app_root/app1 and /app_root/app2)
also containing each a web.config file.

Now if I place the same appSetting node in both the /app_root/web.config and
in /app_root/app1/web.config I only see the most derived - hence the last one
- when querying from the app1 directory. If I also place it in app2/web.config
and then switch from app1 to app2 I actually get the derived setting from
the app2 web.config file instead.

This is very usefull.

Now I have made my own config section reader which Implements
IConfigurationSectionHandler etc.

I still get the most derived when querying - but if I switch directory I get
a cached result - hence if I query app1 I get a correct derived value but if
I then switch to app2 I get the app1 value.

This is true at runtime.

So my conclusion is that the values are cached based on session but though I
have tried to reset everything I cannot free the cache. It must be done at
runtime!

when experimenting with appSettings - no cached problems occured so I know
there is a way!

Hope it makes sense.

regards Mads B
 
G

Guest

The solution is:
return string values from the Config Handler object and not object references.
references will be cached but not values.

/Mads B
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top