<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://forums.asp.net/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Configuration and Deployment</title><link>http://forums.asp.net/26.aspx</link><description>Configuring and deploying ASP.NET applications - web.config, \bin, etc.</description><dc:language>en</dc:language><generator>CommunityServer 2007 SP1 (Build: 20510.895)</generator><item><title>Re: Custom Config Section, .NET 2.0</title><link>http://forums.asp.net/thread/3217515.aspx</link><pubDate>Mon, 08 Jun 2009 11:34:07 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:3217515</guid><dc:creator>ola.linde@3bits.se</dc:creator><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/3217515.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=26&amp;PostID=3217515</wfw:commentRss><description>&lt;font color="#008000" size="1"&gt;&lt;font color="#008000" size="1"&gt;
&lt;p&gt;I recommend trying this add-on for VS2008.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;a href="http://csd.codeplex.com/"&gt;http://csd.codeplex.com/&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;/font&gt;&lt;/font&gt;</description></item><item><title>Re: Custom Config Section, .NET 2.0</title><link>http://forums.asp.net/thread/2174929.aspx</link><pubDate>Fri, 15 Feb 2008 06:38:56 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:2174929</guid><dc:creator>harshah</dc:creator><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/2174929.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=26&amp;PostID=2174929</wfw:commentRss><description>&lt;p&gt;got it :D&lt;/p&gt;&lt;p&gt;for the second level children elements i had to loop through the output. excellent. thnx for all help.&amp;nbsp;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;</description></item><item><title>Re: Custom Config Section, .NET 2.0</title><link>http://forums.asp.net/thread/2174783.aspx</link><pubDate>Fri, 15 Feb 2008 05:30:26 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:2174783</guid><dc:creator>harshah</dc:creator><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/2174783.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=26&amp;PostID=2174783</wfw:commentRss><description>&lt;p&gt;I dont want to do &lt;/p&gt;&lt;p&gt;&amp;nbsp;val = ISconfigs.configs[2].settings[1].Value;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;I wanted to fetch it like hashtable.&amp;nbsp;&lt;/p&gt;&lt;p&gt;&amp;nbsp;val = configs.configs[&amp;quot;SomeName&amp;quot;].settings[key].Value;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;I am lost. how do i go about this now. If i try to &lt;/p&gt;&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; public configElement this[string idx]&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; get&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return (configElement)BaseGet(idx);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; } &lt;br /&gt;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;it does not work.&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;dumb me, please help. thnx in advance.&amp;nbsp;&lt;/p&gt;</description></item><item><title>Re: Custom Config Section, .NET 2.0</title><link>http://forums.asp.net/thread/2173892.aspx</link><pubDate>Thu, 14 Feb 2008 18:53:31 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:2173892</guid><dc:creator>BoulderBum</dc:creator><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/2173892.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=26&amp;PostID=2173892</wfw:commentRss><description>&lt;p&gt;In your ConfigurationElementCollection subclass, you typically have an indexer that uses BaseGet(string) to extract specific elements.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;See here for an example:&lt;br /&gt;&lt;a href="http://msdn2.microsoft.com/en-us/library/system.configuration.configurationelementcollection.aspx"&gt;http://msdn2.microsoft.com/en-us/library/system.configuration.configurationelementcollection.aspx&lt;/a&gt;&lt;/p&gt;</description></item><item><title>Re: Custom Config Section, .NET 2.0</title><link>http://forums.asp.net/thread/2172755.aspx</link><pubDate>Thu, 14 Feb 2008 10:42:33 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:2172755</guid><dc:creator>harshah</dc:creator><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/2172755.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=26&amp;PostID=2172755</wfw:commentRss><description>&lt;p&gt;I need some more help here. How do i go about using this to extract specific filegroup\add[maxsize] .&lt;br /&gt;&lt;br /&gt;help appreciated&amp;nbsp;&lt;/p&gt;&lt;p&gt;thnx loads&amp;nbsp;&lt;/p&gt;</description></item><item><title>Re: Custom Config Section, .NET 2.0</title><link>http://forums.asp.net/thread/1775766.aspx</link><pubDate>Wed, 27 Jun 2007 17:46:27 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:1775766</guid><dc:creator>BoulderBum</dc:creator><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/1775766.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=26&amp;PostID=1775766</wfw:commentRss><description>&lt;p&gt;That was a really great post. Very helpful, and well done!&lt;/p&gt;</description></item><item><title>Re: Custom Config Section, .NET 2.0</title><link>http://forums.asp.net/thread/1396901.aspx</link><pubDate>Tue, 12 Sep 2006 17:05:28 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:1396901</guid><dc:creator>rrahlf</dc:creator><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/1396901.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=26&amp;PostID=1396901</wfw:commentRss><description>&lt;p&gt;Well, I did finaly get this working.&amp;nbsp; I&amp;#39;ll post some links and some advice here for anyone else who is looking.&lt;/p&gt;&lt;p&gt;One of my major problems with implementing a custom config section in .NET 2.0 was the lack of solid documentation.&amp;nbsp; It&amp;#39;s there, but not very deep, and the &amp;quot;example below&amp;quot; examples all seem to be missing at the time I&amp;#39;m writing this.&amp;nbsp; I was able to piece things together thanks to some tenacious people with blogs.&amp;nbsp; Here&amp;#39;s&amp;nbsp;a list of links that helped me out, in no particular order.&lt;/p&gt;&lt;p&gt;&lt;a href="http://fredrik.nsquared2.com/viewpost.aspx?PostID=233"&gt;http://fredrik.nsquared2.com/viewpost.aspx?PostID=233&lt;/a&gt;&lt;/p&gt;&lt;p&gt;&lt;a href="http://msdn2.microsoft.com/en-us/library/ms228062.aspx"&gt;http://msdn2.microsoft.com/en-us/library/ms228062.aspx&lt;/a&gt;&lt;/p&gt;&lt;p&gt;&lt;a href="http://blogs.msdn.com/markgabarra/archive/2006/06/27/648742.aspx"&gt;http://blogs.msdn.com/markgabarra/archive/2006/06/27/648742.aspx&lt;/a&gt;&lt;/p&gt;&lt;p&gt;&lt;a href="http://blogs.msdn.com/markgabarra/archive/2006/06/25/646775.aspx"&gt;http://blogs.msdn.com/markgabarra/archive/2006/06/25/646775.aspx&lt;/a&gt;&lt;/p&gt;&lt;p&gt;&lt;a href="http://msdn.microsoft.com/msdnmag/issues/06/06/ConfigureThis/"&gt;http://msdn.microsoft.com/msdnmag/issues/06/06/ConfigureThis/&lt;/a&gt;&lt;/p&gt;&lt;p&gt;&lt;a href="http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=132716&amp;amp;SiteID=1&amp;amp;mode=1"&gt;http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=132716&amp;amp;SiteID=1&amp;amp;mode=1&lt;/a&gt;&lt;/p&gt;&lt;p&gt;&lt;a href="http://www.agileprogrammer.com/oneagilecoder/archive/2005/06/11/3689.aspx"&gt;http://www.agileprogrammer.com/oneagilecoder/archive/2005/06/11/3689.aspx&lt;/a&gt;&lt;/p&gt;&lt;p&gt;&lt;a href="http://jason.diamond.name/weblog/2006/05/25/custom-configuration-section-validator-weirdness"&gt;http://jason.diamond.name/weblog/2006/05/25/custom-configuration-section-validator-weirdness&lt;/a&gt;&lt;/p&gt;&lt;p&gt;That last link was particularly helpful; it set me in the right direction.&amp;nbsp; Jason Diamond admits that he didn&amp;#39;t look deep enough into the problem to find the reason, but I think I may have found the answer in the Microsoft forums (third last link).&amp;nbsp; &lt;/p&gt;&lt;p&gt;In my mind, the declarative programming model for custom config sections is broken.&amp;nbsp; The issue is with default values,&amp;nbsp;validators, and the ConfigurationElement base class constructor.&amp;nbsp; &lt;/p&gt;&lt;p&gt;It seems that the ConfigurationElement base constructor attempts to set &amp;quot;default&amp;quot; values for your ConfigurationElement&amp;#39;s properties.&amp;nbsp; If it&amp;#39;s an integer property, the ConfigurationElement constructor will attempt to assign a zero to it, &amp;quot;&amp;quot; for a String etc.&amp;nbsp; Reasonably, this default assignment is still passed through any validation&amp;nbsp;you may have assigned to the property declaritively using an attribute, since the declarative validation attribute&amp;#39;s routines are attached to the properties before the constructor attempts to assign a default value (I think).&amp;nbsp; &lt;/p&gt;&lt;p&gt;However, as &lt;a href="http://jason.diamond.name/weblog/2006/05/25/custom-configuration-section-validator-weirdness" title="Jason Diamond"&gt;Jason Diamond&lt;/a&gt; and &lt;a href="http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=132716&amp;amp;SiteID=1&amp;amp;mode=1" title="Paul D. Murphy"&gt;Paul D. Murphy&lt;/a&gt; point out, this becomes a problem if, for example, your validation says that your integer property needs to be between 2 and 5; zero is invalid.&amp;nbsp; OK, so you also decorate your property with the DefaultValue attribute and inform the ConfigurationElement constuctor that when it assigns a value to that property, it should use, say, 3 instead of zero.&amp;nbsp; Now the framework can instantiate your ConfigurationElement derived class without the validator throwing an error.&amp;nbsp; But.&lt;/p&gt;&lt;p&gt;Now you have a property of your ConfigurationElement that has a default value.&amp;nbsp; Default value...that means that the implementor/user of your custom configuration section is no longer required to type in a value for that property (an attribute on an xml tag in the config file).&amp;nbsp; What if you wanted to require that the implementor type a value?&amp;nbsp; You&amp;#39;re stuck, if you wanted to use the declarative model to code your custom config section.&amp;nbsp; The only solution is to use the programatic model.&lt;/p&gt;&lt;p&gt;Justin Diamonds post shows how this can be done.&amp;nbsp; &lt;a href="http://jason.diamond.name/weblog/2006/05/25/custom-configuration-section-validator-weirdness"&gt;http://jason.diamond.name/weblog/2006/05/25/custom-configuration-section-validator-weirdness&lt;/a&gt;&lt;/p&gt;&lt;p&gt;&lt;strong&gt;Another Tip:&lt;/strong&gt;&lt;/p&gt;&lt;p&gt;If you want to have a ConfigurationElementCollection in your config section without actually having a parent&amp;nbsp;tag around the collection, declare the collection name in the ConfigurationProperty attribute as an empty string.&amp;nbsp; For example if you have a &amp;lt;MyConfigSection&amp;gt; section with a collection of FileGroup elements, you can code:&lt;/p&gt;&lt;pre class="coloredcode"&gt;       &amp;lt;ConfigurationProperty(&lt;span class="st"&gt;&amp;quot;&amp;quot;&lt;/span&gt;, IsRequired:=&lt;span class="kwd"&gt;True&lt;/span&gt;, IsDefaultCollection:=&lt;span class="kwd"&gt;True&lt;/span&gt;)&amp;gt; _
        &lt;span class="kwd"&gt;Public Property&lt;/span&gt; FileGroups() &lt;span class="kwd"&gt;As&lt;/span&gt; FileGroupCollection
            &lt;span class="kwd"&gt;Get
                Return CType&lt;/span&gt;(&lt;span class="kwd"&gt;Me&lt;/span&gt;(&lt;span class="st"&gt;&amp;quot;&amp;quot;&lt;/span&gt;), FileGroupCollection)
            &lt;span class="kwd"&gt;End Get
            Set&lt;/span&gt;(&lt;span class="kwd"&gt;ByVal&lt;/span&gt; value &lt;span class="kwd"&gt;As&lt;/span&gt; FileGroupCollection)
                &lt;span class="kwd"&gt;Me&lt;/span&gt;(&lt;span class="st"&gt;&amp;quot;&amp;quot;&lt;/span&gt;) = value
            &lt;span class="kwd"&gt;End Set
        End Property&lt;/span&gt;&lt;/pre&gt;&lt;p&gt;&amp;nbsp;which will give you:&lt;/p&gt;&lt;pre class="coloredcode"&gt;&amp;lt;&lt;span class="tag"&gt;MySection&lt;/span&gt;&amp;gt;
   &amp;lt;&lt;span class="tag"&gt;FileGroup/&lt;/span&gt;&amp;gt;
   &amp;lt;&lt;span class="tag"&gt;FileGroup/&lt;/span&gt;&amp;gt;
   &amp;lt;&lt;span class="tag"&gt;FileGropu/&lt;/span&gt;&amp;gt;
&amp;lt;&lt;span class="tag"&gt;MySection&lt;/span&gt;&amp;gt;&lt;/pre&gt;&lt;p&gt;&amp;nbsp;as opposed to &lt;/p&gt;&lt;pre class="coloredcode"&gt;&amp;lt;ConfigurationProperty(&lt;span class="st"&gt;&amp;quot;&lt;strong&gt;FileGroups&lt;/strong&gt;&amp;quot;&lt;/span&gt;, IsRequired:=&lt;span class="kwd"&gt;True&lt;/span&gt;, IsDefaultCollection:=&lt;span class="kwd"&gt;True&lt;/span&gt;)&amp;gt;&lt;/pre&gt;&lt;p&gt;&amp;nbsp;which would require the section to look like:&lt;/p&gt;&lt;pre class="coloredcode"&gt;&amp;lt;&lt;span class="tag"&gt;MySection&lt;/span&gt;&amp;gt;
   &amp;lt;&lt;span class="tag"&gt;FileGroups&lt;/span&gt;&amp;gt;
      &amp;lt;&lt;span class="tag"&gt;FileGroup/&lt;/span&gt;&amp;gt;
      &amp;lt;&lt;span class="tag"&gt;FileGroup/&lt;/span&gt;&amp;gt;
      &amp;lt;&lt;span class="tag"&gt;FileGropu/&lt;/span&gt;&amp;gt;
   &amp;lt;/&lt;span class="tag"&gt;FileGroups&lt;/span&gt;&amp;gt;
&amp;lt;&lt;span class="tag"&gt;MySection&lt;/span&gt;&amp;gt;&lt;/pre&gt;&lt;p&gt;&amp;nbsp;&lt;strong&gt;Something Odd&lt;/strong&gt;&lt;/p&gt;&lt;p&gt;Most of the example code I&amp;#39;ve found on the&amp;nbsp;web write the property accessors as I did above, using Me(&amp;quot;someName&amp;quot;) (or base[&amp;quot;someName&amp;quot;] in C#) to store the values.&amp;nbsp; Reading the documentation, it looks like the default the default property of the ConfigurationElement is Item(), but tracing through the code I found that the values I was trying to retrieve&amp;nbsp;could be found in&amp;nbsp;the Values property collection (a hash I think, probably a ConfigurationPropertiesCollection object) , a property which doesn&amp;#39;t appear in the MSDN documentation for the ConfigurationElement.&amp;nbsp; Me(&amp;quot;someName&amp;quot;) seems to be functionaly&amp;nbsp;equivalent to Me.Values(&amp;quot;someName&amp;quot;).&amp;nbsp; I&amp;#39;m not sure why they omitted that from the documentation, or what purpose the Item() property serves except that it&amp;#39;s documented as:&lt;/p&gt;&lt;p&gt;In C#, this property is the indexer for the&amp;nbsp;ConfigurationSectionCollection class. &lt;/p&gt;&lt;p&gt;which leaves me wondering why it&amp;#39;s in the ConfigurationElement class and what it does for VB.&amp;nbsp; In my explorations, I found that Me.Item(&amp;quot;someName&amp;quot;) couldn&amp;#39;t get me to my value, but Me.Values(&amp;quot;someName&amp;quot;) could.&amp;nbsp; If anyone has some insight into this, I&amp;#39;d be very happy to hear it.&lt;/p&gt;&lt;p&gt;I hope this helps someone out.&lt;/p&gt;</description></item><item><title>Custom Config Section, .NET 2.0</title><link>http://forums.asp.net/thread/1380269.aspx</link><pubDate>Thu, 24 Aug 2006 22:25:17 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:1380269</guid><dc:creator>rrahlf</dc:creator><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/1380269.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=26&amp;PostID=1380269</wfw:commentRss><description>&lt;p&gt;I'm trying to write a custom config section in .NET 2.0.&amp;nbsp; I'm having a hard time finding broad examples of how to use the ConfigSection, ConfigElementCollection and ConfigElement classes...particularly the ElementCollection.&amp;nbsp; Of course, my code look ok to me but not the app, or I wouldn't be here.&amp;nbsp; ;-)&amp;nbsp; I get various errors, mostly non-specific, like "Exception has been thrown by the target of an invocation".&lt;/p&gt;
&lt;p&gt;Can anyone help me find where I went astray here?&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Here's the XML&lt;/strong&gt; (ignore the erronious values):&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&lt;/p&gt;&lt;pre class=coloredcode&gt;&amp;lt;&lt;span class=tag&gt;uploadDirector&lt;/span&gt;&amp;gt;
    &amp;lt;&lt;span class=tag&gt;filegroup&lt;/span&gt;&lt;span class=attr&gt; name=&lt;/span&gt;&lt;span class=attrv&gt;"documents"&lt;/span&gt;&lt;span class=attr&gt; defaultDirectory=&lt;/span&gt;&lt;span class=attrv&gt;"/documents/"&lt;/span&gt;&amp;gt;
      &amp;lt;&lt;span class=tag&gt;clear/&lt;/span&gt;&amp;gt;
      &amp;lt;&lt;span class=tag&gt;add&lt;/span&gt;&lt;span class=attr&gt; extention=&lt;/span&gt;&lt;span class=attrv&gt;"pdf"&lt;/span&gt;&lt;span class=attr&gt; mime=&lt;/span&gt;&lt;span class=attrv&gt;"application/pdf"&lt;/span&gt;&lt;span class=attr&gt; maxsize=&lt;/span&gt;&lt;span class=attrv&gt;"100"&lt;/span&gt;/&amp;gt;
      &amp;lt;&lt;span class=tag&gt;add&lt;/span&gt;&lt;span class=attr&gt; extention=&lt;/span&gt;&lt;span class=attrv&gt;"doc"&lt;/span&gt;&lt;span class=attr&gt; mime=&lt;/span&gt;&lt;span class=attrv&gt;"application/word"&lt;/span&gt;&lt;span class=attr&gt; maxsize=&lt;/span&gt;&lt;span class=attrv&gt;"500"&lt;/span&gt;/&amp;gt;
    &amp;lt;/&lt;span class=tag&gt;filegroup&lt;/span&gt;&amp;gt;
    &amp;lt;&lt;span class=tag&gt;filegroup&lt;/span&gt;&lt;span class=attr&gt; name=&lt;/span&gt;&lt;span class=attrv&gt;"images"&lt;/span&gt;&amp;gt;
      &amp;lt;&lt;span class=tag&gt;clear/&lt;/span&gt;&amp;gt;
      &amp;lt;&lt;span class=tag&gt;add&lt;/span&gt;&lt;span class=attr&gt; extention=&lt;/span&gt;&lt;span class=attrv&gt;"gif"&lt;/span&gt;&lt;span class=attr&gt; mime=&lt;/span&gt;&lt;span class=attrv&gt;"image/gif"&lt;/span&gt;&lt;span class=attr&gt; maxsize=&lt;/span&gt;&lt;span class=attrv&gt;"100"&lt;/span&gt;/&amp;gt;
    &amp;lt;/&lt;span class=tag&gt;filegroup&lt;/span&gt;&amp;gt;
&amp;lt;/&lt;span class=tag&gt;uploadDirector&lt;/span&gt;&amp;gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Here's the ConfigSection class&lt;/strong&gt;:&lt;/p&gt;&lt;pre&gt;&lt;/pre&gt;&lt;span class=kwd&gt;&lt;pre class=coloredcode&gt;    &lt;span class=kwd&gt;Public Class&lt;/span&gt; UploadDirectorConfigSection
        &lt;span class=kwd&gt;Inherits&lt;/span&gt; ConfigurationSection

        &lt;span class=kwd&gt;Private&lt;/span&gt; _rootpath &lt;span class=kwd&gt;As String

        Public Sub New&lt;/span&gt;()
        &lt;span class=kwd&gt;End Sub&lt;/span&gt;

        &amp;lt;ConfigurationProperty(&lt;span class=st&gt;"rootpath"&lt;/span&gt;, DefaultValue:=&lt;span class=st&gt;"/"&lt;/span&gt;, IsRequired:=&lt;span class=kwd&gt;False&lt;/span&gt;, IsKey:=&lt;span class=kwd&gt;False&lt;/span&gt;)&amp;gt; _
        &amp;lt;StringValidator(InvalidCharacters:=&lt;span class=st&gt;"~!.@#$%^&amp;amp;*()[]{};&lt;span class=cmt&gt;'\|\\")&amp;gt; _
&lt;/span&gt;
        Public Property RootPath() As String
            Get
                Return _rootpath
            End Get
            Set(ByVal value As String)
                _rootpath = value
            End Set
        End Property

        &amp;lt;ConfigurationProperty("&lt;/span&gt;&lt;span class=st&gt;", IsRequired:=True, IsKey:=False, IsDefaultCollection:=True)&amp;gt; _
        Public Property FileGroups() As FileGroupCollection
            Get
                Return MyBase.Item("")
            End Get
            Set(ByVal value As FileGroupCollection)
                MyBase.Item("&lt;/span&gt;") = value
            &lt;span class=kwd&gt;End Set
        End Property

    End Class&lt;/span&gt;&lt;/pre&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;/span&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;And here's the first collection, FileGroupCollection&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&amp;nbsp;&lt;pre class=coloredcode&gt;    Public Class FileGroupCollection
        Inherits ConfigurationElementCollection

        Protected Overrides Function CreateNewElement() As System.Configuration.ConfigurationElement
            Return New FileGroupElement
        End Function

        Protected Overrides Function GetElementKey(ByVal element As System.Configuration.ConfigurationElement) As Object
            Return DirectCast(element, FileGroupElement).name
        End Function

        Public Overrides ReadOnly Property CollectionType() As ConfigurationElementCollectionType
            Get
                Return ConfigurationElementCollectionType.BasicMap
            End Get
        End Property

        Protected Overrides ReadOnly Property ElementName() As String
            Get
                Return &lt;span class=st&gt;"filegroup"&lt;/span&gt;
            End Get
        End Property

        Protected Overrides Function IsElementName(ByVal elementName As String) As Boolean
            If ((String.IsNullOrEmpty(elementName)) Or (elementName &amp;lt;&amp;gt; &lt;span class=st&gt;"filegroup"&lt;/span&gt;)) Then
                Return False
            End If
            Return True
        End Function

        Public Overloads Property Item(ByVal index As Integer) As FileGroupElement
            Get
                Return DirectCast(MyBase.BaseGet(index), FileGroupElement)
            End Get
            Set(ByVal &lt;span class=kwd&gt;value&lt;/span&gt; As FileGroupElement)
                If Not MyBase.BaseGet(index) Is Nothing Then
                    MyBase.BaseRemoveAt(index)
                End If
                MyBase.BaseAdd(index, &lt;span class=kwd&gt;value&lt;/span&gt;)
            End Set
        End Property

    End Class&lt;/pre&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;The FileGroupElement class:&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&amp;nbsp;&lt;pre class=coloredcode&gt;    &lt;span class=kwd&gt;Public Class&lt;/span&gt; FileGroupElement
        &lt;span class=kwd&gt;Inherits&lt;/span&gt; ConfigurationElement

        &amp;lt;ConfigurationProperty(&lt;span class=st&gt;"name"&lt;/span&gt;, IsKey:=&lt;span class=kwd&gt;True&lt;/span&gt;, IsRequired:=&lt;span class=kwd&gt;True&lt;/span&gt;)&amp;gt; _
        &amp;lt;StringValidator(InvalidCharacters:=&lt;span class=st&gt;" ~.!@#$%^&amp;amp;*()[]{}/;&lt;span class=cmt&gt;'""|\")&amp;gt; _
&lt;/span&gt;
        Public Property Name() As String
            Get
                Return CType(MyBase.Item("&lt;/span&gt;name&lt;span class=st&gt;"), String)
            End Get
            Set(ByVal value As String)
                MyBase.Item("&lt;/span&gt;name&lt;span class=st&gt;") = value
            End Set
        End Property

        &lt;span class=cmt&gt;'TODO:RegExp validate this
&lt;/span&gt;
        &amp;lt;ConfigurationProperty("&lt;/span&gt;defaultDirectory&lt;span class=st&gt;", DefaultValue:="&lt;/span&gt;.&lt;span class=st&gt;")&amp;gt; _
        Public Property DefaultDirectory() As String
            Get
                Return MyBase.Item("&lt;/span&gt;Path&lt;span class=st&gt;")
            End Get
            Set(ByVal value As String)
                MyBase.Item("&lt;/span&gt;Path&lt;span class=st&gt;") = value
            End Set
        End Property

        &amp;lt;ConfigurationProperty("", IsDefaultCollection:=True, IsRequired:=True)&amp;gt; _
        Public ReadOnly Property Files() As FileInfoCollection
            Get
                Return MyBase.Item("&lt;/span&gt;")
            &lt;span class=kwd&gt;End Get
        End Property
    End Class&lt;/span&gt;&lt;/pre&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Next, the FileInfoCollection&lt;/strong&gt;, which should be the default type of AddRemoveClearMap:&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&amp;nbsp;&lt;pre class=coloredcode&gt;    &lt;span class=kwd&gt;Public Class&lt;/span&gt; FileInfoCollection
        &lt;span class=kwd&gt;Inherits&lt;/span&gt; ConfigurationElementCollection

        &lt;span class=kwd&gt;Protected Overrides Function&lt;/span&gt; CreateNewElement() &lt;span class=kwd&gt;As&lt;/span&gt; System.Configuration.ConfigurationElement
            &lt;span class=kwd&gt;Return New&lt;/span&gt; FileInfoElement()
        &lt;span class=kwd&gt;End Function

        Protected Overrides Function&lt;/span&gt; GetElementKey(&lt;span class=kwd&gt;ByVal&lt;/span&gt; element &lt;span class=kwd&gt;As&lt;/span&gt; System.Configuration.ConfigurationElement) &lt;span class=kwd&gt;As Object
            Return DirectCast&lt;/span&gt;(element, FileInfoElement).FileExtention
        &lt;span class=kwd&gt;End Function


    End Class&lt;/span&gt;&lt;/pre&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;And Lastly, the FileInfoElement:&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&amp;nbsp;&lt;pre class=coloredcode&gt;    &lt;span class=kwd&gt;Public Class&lt;/span&gt; FileInfoElement
        &lt;span class=kwd&gt;Inherits&lt;/span&gt; ConfigurationElement

        &lt;span class=kwd&gt;Public Sub New&lt;/span&gt;()
            &lt;span class=kwd&gt;Me&lt;/span&gt;.FileExtention = &lt;span class=st&gt;"txt"&lt;/span&gt;
            &lt;span class=kwd&gt;Me&lt;/span&gt;.MIME = &lt;span class=st&gt;"text/plain"&lt;/span&gt;
            &lt;span class=kwd&gt;Me&lt;/span&gt;.MaxSize = 0
        &lt;span class=kwd&gt;End Sub&lt;/span&gt;

        &amp;lt;ConfigurationProperty(&lt;span class=st&gt;"extention"&lt;/span&gt;, IsKey:=&lt;span class=kwd&gt;True&lt;/span&gt;, IsRequired:=&lt;span class=kwd&gt;True&lt;/span&gt;)&amp;gt; _
        &lt;span class=kwd&gt;Public Property&lt;/span&gt; FileExtention() &lt;span class=kwd&gt;As String
            Get
                Return MyBase&lt;/span&gt;.Item(&lt;span class=st&gt;"Extention"&lt;/span&gt;)
            &lt;span class=kwd&gt;End Get
            Set&lt;/span&gt;(&lt;span class=kwd&gt;ByVal&lt;/span&gt; value &lt;span class=kwd&gt;As String&lt;/span&gt;)
                &lt;span class=kwd&gt;MyBase&lt;/span&gt;.Item(&lt;span class=st&gt;"Extention"&lt;/span&gt;) = value
            &lt;span class=kwd&gt;End Set
        End Property&lt;/span&gt;

        &amp;lt;ConfigurationProperty(&lt;span class=st&gt;"mime"&lt;/span&gt;, DefaultValue:=&lt;span class=st&gt;"text/plain"&lt;/span&gt;)&amp;gt; _
        &lt;span class=kwd&gt;Public Property&lt;/span&gt; MIME() &lt;span class=kwd&gt;As String
            Get
                Return MyBase&lt;/span&gt;.Item(&lt;span class=st&gt;"MIME"&lt;/span&gt;)
            &lt;span class=kwd&gt;End Get
            Set&lt;/span&gt;(&lt;span class=kwd&gt;ByVal&lt;/span&gt; value &lt;span class=kwd&gt;As String&lt;/span&gt;)
                &lt;span class=kwd&gt;MyBase&lt;/span&gt;.Item(&lt;span class=st&gt;"MIME"&lt;/span&gt;) = value
            &lt;span class=kwd&gt;End Set
        End Property&lt;/span&gt;

        &amp;lt;ConfigurationProperty(&lt;span class=st&gt;"maxsize"&lt;/span&gt;, DefaultValue:=&lt;span class=st&gt;"0"&lt;/span&gt;)&amp;gt; _
        &amp;lt;IntegerValidator(MinValue:=0)&amp;gt; _
        &lt;span class=kwd&gt;Public Property&lt;/span&gt; MaxSize() &lt;span class=kwd&gt;As Integer
            Get
                Return MyBase&lt;/span&gt;.Item(&lt;span class=st&gt;"MaxSize"&lt;/span&gt;)
            &lt;span class=kwd&gt;End Get
            Set&lt;/span&gt;(&lt;span class=kwd&gt;ByVal&lt;/span&gt; value &lt;span class=kwd&gt;As Integer&lt;/span&gt;)
                &lt;span class=kwd&gt;MyBase&lt;/span&gt;.Item(&lt;span class=st&gt;"MaxSize"&lt;/span&gt;) = value
            &lt;span class=kwd&gt;End Set
        End Property&lt;/span&gt;

        &amp;lt;ConfigurationProperty(&lt;span class=st&gt;"validatorType"&lt;/span&gt;)&amp;gt; _
        &lt;span class=kwd&gt;Public Property&lt;/span&gt; FileValidatorType() &lt;span class=kwd&gt;As String
            Get
                Return MyBase&lt;/span&gt;.Item(&lt;span class=st&gt;"ValidatorType"&lt;/span&gt;)
            &lt;span class=kwd&gt;End Get
            Set&lt;/span&gt;(&lt;span class=kwd&gt;ByVal&lt;/span&gt; value &lt;span class=kwd&gt;As String&lt;/span&gt;)
                &lt;span class=kwd&gt;MyBase&lt;/span&gt;.Item(&lt;span class=st&gt;"ValidatorType"&lt;/span&gt;) = value
            &lt;span class=kwd&gt;End Set
        End Property

    End Class&lt;/span&gt;&lt;/pre&gt;&lt;pre class=coloredcode&gt;&lt;span class=kwd&gt;&lt;/span&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre class=coloredcode&gt;&lt;span class=kwd&gt;&lt;/span&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre class=coloredcode&gt;&lt;span class=kwd&gt;&lt;/span&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre class=coloredcode&gt;&lt;span class=kwd&gt;&lt;/span&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre class=coloredcode&gt;&lt;span class=kwd&gt;&lt;/span&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre class=coloredcode&gt;&lt;span class=kwd&gt;&lt;/span&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre class=coloredcode&gt;&lt;span class=kwd&gt;&lt;/span&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre class=coloredcode&gt;&lt;span class=kwd&gt;&lt;/span&gt;&amp;nbsp;&lt;/pre&gt;&amp;nbsp;&lt;pre class=coloredcode&gt;    &lt;/pre&gt;&amp;nbsp;</description></item></channel></rss>