Note that there are some explanatory texts on larger screens.

plurals
  1. POGet/Set AppSetting from subdirectory configuration
    primarykey
    data
    text
    <p>Using ASP.NET under .NET 2.0, is it possible to get/set AppSettings in a web.config in a sub-directory, from a page in the root directory? When I say "set", I do not need a permanent setting of the value, just simply updating the value in memory is sufficient.</p> <p>I have a web application which has the standard root <code>web.config</code> file, which has system wide configuration settings. </p> <p>The application also has a number of sub-directories, each one being a separate part of the system, and each having their own <code>web.config</code> file containing configurations that are only necessary for that particular section. (All code within these sections is also built under their own individual <code>NameSpace</code>.)</p> <p>Is it possible for code within the root directory to get or set an individual <code>&lt;add key="" value=""/&gt;</code> configuration setting from a sub-directory?</p> <p>So, for example, if I call a page in the root of the web application (e.g. <code>~/Default.aspx</code>) could it somehow manually lookup an individual configuration value from the <code>~/Section1/web.config</code> file?</p> <p>My guess this cannot be done, but I wanted to ask here first</p> <hr> <p>One thought I had - that I've tried but <strong>doesn't</strong> work - was to have a UserControl within each section with public properties to get the values. Then dynamically load the control from with the root page code and call a property to get the value. However, even though the UserControl is hosted with in the sub-directory, and is part of the sub-directory namespace, it is still not picking up the <code>web.config</code> settings within that sub-directory.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload