Re: Custom Configuration Sections in Location Tag

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



By virtual location I mean that in my web.config I need to set something
simular to this:

<configuration>
<configSections>
<add name='customSectionGroup" ...>
</configSections>
<customSectionGroup>
<customSection>
<customOption />
</customSection>
</customSectionGroup>
<location path="someVirtualDirectory">
<customSectionGroup>
<customSection>
<customOption />
</customSection>
</customSectionGroup>
</location>
</configuration>

Then in our web site, have the option(s) set in the <customSectionGroup> be
in effect all of the site save within ~/someVirtualDirectory, where I need
the option(s) in the <location><customSectionGroup> tag to be in effect.

I know how to write the code to read the default <customSectionGroup>.
However, getting the information from within the
<location><customSectionGroup> is currently baffling me.

I hope that this makes more sense.

David

"Michael Nemtsev [MVP]" <nemtsev@xxxxxxx> wrote in message
news:900895ec719858caf34952ffe440@xxxxxxxxxxxxxxxxxxxxxxx
Hello David,

Could you explain in details what u mean with "virtual location" for
config files.
Did you try to create external config and refer to in from you main
webconfig?!

---
WBR, Michael Nemtsev [Microsoft MVP] :: blog:
http://spaces.live.com/laflour :: http://twitter.com/laflour

"The greatest danger for most of us is not that our aim is too high and we
miss it, but that it is too low and we reach it" (c) Michelangelo

DW> I am familiar with creating custom configuration settings and
DW> accessing them. However, for a current requirement, I need to
DW> control the various settings in my custom configuration section by
DW> virtual location of the pages accessing the configuration
DW> information. The best way that I know is to do this via the use of
DW> the location tag in the web.config.
DW> DW> However, I can not seem to get the correct instance of the
DW> configuration section in my configuration class. What is the
DW> correct method for retrieving the current configuration based on the
DW> virtual location?
DW> DW> David
DW>



.



Relevant Pages

  • Re: Custom Configuration Sections in Location Tag
    ... <customSectionGroup> ... Then in our web site, have the optionset in the be in effect all of the site save within ~/someVirtualDirectory, where I need the optionin the tag to be in effect. ... What's meant to happen is that when you look at that configuration section from a page running under that location, then the page will see the combined configuration data. ... the configuration elements are all merged together into one logical configuration associated with each folder in the web application. ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Custom Configuration Sections in Location Tag
    ... Could you explain in details what u mean with "virtual location" for config files. ... DW> I am familiar with creating custom configuration settings and ... DW> control the various settings in my custom configuration section by ... I can not seem to get the correct instance of the ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Custom Configuration Sections in Location Tag
    ... When I do a read of the configuration (using ... <customSectionGroup> ... the configuration elements are all merged together into one ... logical configuration associated with each folder in the web application. ...
    (microsoft.public.dotnet.framework.aspnet)
  • Custom Configuration Sections in Location Tag
    ... I am familiar with creating custom configuration settings and accessing ... settings in my custom configuration section by virtual location of the pages ...
    (microsoft.public.dotnet.framework.aspnet)