How to get values from custom config section?

Discussion in 'ASP .Net' started by Showjumper, Sep 25, 2007.

  1. Showjumper

    Showjumper Guest

    Given this custom config section:
    <HttpResourceHandlerSettings compressionOn="true" daysInCache="30">
    <fileSets>
    <add name="FileSet_CSS_Style1"
    value="~/styles/rdstyles.css,~/styles/thickbox.css" />
    <add name="FileSet_AdminCSS_Style1"
    value="~/styles/rdstyles.css,~/styles/StyleSheet.css" />
    <add name="FileSet_JS_Functionality1"
    value="~/scripts/jquery.js,~/scripts/thickbox.js" />
    </fileSets>
    </HttpResourceHandlerSettings>

    I want to retrieve the value for a given name i.e.something like the
    following pseudocode:
    settings.FileSets.Name("FileSet_" & fileSet).value where fileSet is a
    querystring value -
    Dim fileSet As String = Context.Request.QueryString("fileSet") and a sample
    link tag -
    <link type="text/css"
    href="resourcehandler.aspx?fileSet=CSS_Style1&type=text/css"
    rel="Stylesheet"/>

    All this is to be functionally equiv to
    ConfigurationManager.AppSettings(("FileSet_" + fileSet))

    This possible?

    Ashok Padmanabhan DVM
    Thank you...
     
    Showjumper, Sep 25, 2007
    #1
    1. Advertising

  2. Showjumper

    sloan Guest

    When you have a custom config section, you have to write the "Handler" for
    it.

    While not related to your issue/type of data, you can see one here:
    http://sholliday.spaces.live.com/Blog/cns!A68482B9628A842A!138.entry

    Look at the EmailSmtpSettingsHandler code (from the download).




    "Showjumper" <nlsdkfja> wrote in message
    news:uVWHGX7$...
    > Given this custom config section:
    > <HttpResourceHandlerSettings compressionOn="true" daysInCache="30">
    > <fileSets>
    > <add name="FileSet_CSS_Style1"
    > value="~/styles/rdstyles.css,~/styles/thickbox.css" />
    > <add name="FileSet_AdminCSS_Style1"
    > value="~/styles/rdstyles.css,~/styles/StyleSheet.css" />
    > <add name="FileSet_JS_Functionality1"
    > value="~/scripts/jquery.js,~/scripts/thickbox.js" />
    > </fileSets>
    > </HttpResourceHandlerSettings>
    >
    > I want to retrieve the value for a given name i.e.something like the
    > following pseudocode:
    > settings.FileSets.Name("FileSet_" & fileSet).value where fileSet is a
    > querystring value -
    > Dim fileSet As String = Context.Request.QueryString("fileSet") and a
    > sample link tag -
    > <link type="text/css"
    > href="resourcehandler.aspx?fileSet=CSS_Style1&type=text/css"
    > rel="Stylesheet"/>
    >
    > All this is to be functionally equiv to
    > ConfigurationManager.AppSettings(("FileSet_" + fileSet))
    >
    > This possible?
    >
    > Ashok Padmanabhan DVM
    > Thank you...
    >
    >
     
    sloan, Sep 25, 2007
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. James Coe
    Replies:
    2
    Views:
    650
    James Coe
    Aug 29, 2003
  2. =?iso-8859-1?Q?S=F8ren_Lund?=

    Custom Config Section Handler

    =?iso-8859-1?Q?S=F8ren_Lund?=, May 11, 2004, in forum: ASP .Net
    Replies:
    0
    Views:
    530
    =?iso-8859-1?Q?S=F8ren_Lund?=
    May 11, 2004
  3. Thorsten Tarrach

    Caching config section values

    Thorsten Tarrach, Aug 19, 2009, in forum: ASP .Net
    Replies:
    2
    Views:
    281
    Thorsten Tarrach
    Aug 20, 2009
  4. MichaelS
    Replies:
    0
    Views:
    449
    MichaelS
    Nov 22, 2006
  5. kampy
    Replies:
    9
    Views:
    361
    Steven D'Aprano
    Oct 19, 2012
Loading...

Share This Page