Professional Web Applications Themes

Declaring custom configuration section. - ASP.NET General

H! Im implementing a web application using the Front Controller pattern described in the Enterprice Solutions Patters using Microsoft .NET v 1.0 In order to map an absolute path to another URL, an UrlMap class is implemented. This class implements the IConfigurationSectionHandler interface. The mapping is defined in the Web.config file as shown: <controller.mapping> <entries> <entry key="/patterns/frontc/3/Page1.aspx" url="ActualPage1.aspx" /> <entry key="/patterns/frontc/3/Page2.aspx" url="ActualPage2.aspx" /> </entries> </controller.mapping> Then, I defined a custom section for "controller.mapping" <configSections> <section name="controller.mapping" type="UrlMap" /> </configSections> UrlMap uses the followin method to access the custom section. ConfigurationSettings.GetConfig("controller.mappin g"); But when I try to run my application, its ...

Sponsored Links
  1. #1

    Default Declaring custom configuration section.

    H!

    Im implementing a web application using the Front
    Controller pattern described in the Enterprice Solutions
    Patters using Microsoft .NET v 1.0

    In order to map an absolute path to another URL, an
    UrlMap class is implemented. This class implements the
    IConfigurationSectionHandler interface.

    The mapping is defined in the Web.config file as shown:

    <controller.mapping>
    <entries>
    <entry key="/patterns/frontc/3/Page1.aspx"
    url="ActualPage1.aspx" />
    <entry key="/patterns/frontc/3/Page2.aspx"
    url="ActualPage2.aspx" />
    </entries>
    </controller.mapping>

    Then, I defined a custom section for "controller.mapping"

    <configSections>
    <section name="controller.mapping"
    type="UrlMap" />
    </configSections>

    UrlMap uses the followin method to access the custom
    section.
    ConfigurationSettings.GetConfig("controller.mappin g");

    But when I try to run my application, its raised the
    following error:

    Pr Error Message: Exception creating section handler.

    Line 3:
    Line 4: <configSections>
    Line 5: <section name="controller.mapping"
    type="Volvo.Evaluacion.Web.UrlMap" />
    Line 6: </configSections>
    Line 7:

    I dont know if my custom section is well declared. Can
    anyone help me????
    Sponsored Links
    Mauricio Guest

  2. #2

    Default Re: Declaring custom configuration section.

    Mauricio,

    I believe you may need to name your assembly in your <section type>
    attribute, and put the assembly where it can be found (or in the GAC). Look
    at %WINDIR%\Microsoft.Net\Framework\<version>\CONFIG\ machine.config for
    examples.
    --
    John Saunders
    Internet Engineer
    com


    John Guest

  3. #3

    Default Re: Declaring custom configuration section.

    The type attribute in you section declaration must be a class implementing
    IConfigurationSectionHandler and will allow you to access the section, not
    the class that will be using the section.

    Jerry

    "Mauricio" <com> wrote in message
    news:01aa01c368d8$497d7810$gbl...
    H!

    Im implementing a web application using the Front
    Controller pattern described in the Enterprice Solutions
    Patters using Microsoft .NET v 1.0

    In order to map an absolute path to another URL, an
    UrlMap class is implemented. This class implements the
    IConfigurationSectionHandler interface.

    The mapping is defined in the Web.config file as shown:

    <controller.mapping>
    <entries>
    <entry key="/patterns/frontc/3/Page1.aspx"
    url="ActualPage1.aspx" />
    <entry key="/patterns/frontc/3/Page2.aspx"
    url="ActualPage2.aspx" />
    </entries>
    </controller.mapping>

    Then, I defined a custom section for "controller.mapping"

    <configSections>
    <section name="controller.mapping"
    type="UrlMap" />
    </configSections>

    UrlMap uses the followin method to access the custom
    section.
    ConfigurationSettings.GetConfig("controller.mappin g");

    But when I try to run my application, its raised the
    following error:

    Pr Error Message: Exception creating section handler.

    Line 3:
    Line 4: <configSections>
    Line 5: <section name="controller.mapping"
    type="Volvo.Evaluacion.Web.UrlMap" />
    Line 6: </configSections>
    Line 7:

    I dont know if my custom section is well declared. Can
    anyone help me????


    Jerry Guest

  4. #4

    Default Re: Declaring custom configuration section.


    It works!!

    Thanks,
    Mauricio.
    Mauricio Guest

Similar Threads

  1. Custom ASP.NET Control configuration wizard
    By Allan Doensen in forum ASP.NET Building Controls
    Replies: 2
    Last Post: January 10th, 04:01 PM
  2. Replies: 2
    Last Post: March 7th, 06:18 PM
  3. Replies: 2
    Last Post: January 11th, 11:56 AM
  4. Exception in configuration section handler.
    By Ollie Riches in forum ASP.NET Web Services
    Replies: 2
    Last Post: March 8th, 02:42 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139