title: How to enable IDN/IRI Support for URI-Class by code?
body: <p>I'm trying to enable the IDN/IRI support for the URI class, because I need the "Uri.IsWellFormedUriString" method on german umlaut-domains (e.g. www.bücher.de).</p>
  
  <p>I found similar question at <a href="https://stackoverflow.com/a/6107682/413531">https://stackoverflow.com/a/6107682/413531</a> (taken from <a href="http://msdn.microsoft.com/en-us/library/system.uri.aspx" rel="nofollow noreferrer">http://msdn.microsoft.com/en-us/library/system.uri.aspx</a> at "International Resource Identifier Support") but the solution is not working for me. My current app.config file looks something like this:</p>
  
  <pre><code>&lt;configuration&gt;
      &lt;configSections&gt;
          &lt;sectionGroup name="userSettings" type="System.Configuration.UserSettingsGroup, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" &gt;
              &lt;section name="..." type="System.Configuration.ClientSettingsSection, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" /&gt;
          &lt;!-- ... some sections in here ... --&gt;
          &lt;/sectionGroup&gt;
          &lt;sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" &gt;
          &lt;!-- ... some sections in here ... --&gt;
          &lt;/sectionGroup&gt;
      &lt;/configSections&gt;
      &lt;userSettings&gt;
          &lt;!-- ... some settings in here ... --&gt;
      &lt;/userSettings&gt;
      &lt;applicationSettings&gt;
          &lt;!-- ... some settings in here ... --&gt;
      &lt;/applicationSettings&gt;
  &lt;/configuration&gt;
  </code></pre>
  
  <p>when I just add</p>
  
  <pre><code>  &lt;uri&gt;
    &lt;idn enabled="All" /&gt;
    &lt;iriParsing enabled="true" /&gt;
    &lt;/uri&gt;
  </code></pre>
  
  <p>as an other child of  at the end, an exception is thrown: ConfigurationErrorsException - {"Das Konfigurationssystem konnte nicht initialisiert werden."}</p>
  
  <p>So I read further in <a href="http://msdn.microsoft.com/en-us/library/system.uri.aspx" rel="nofollow noreferrer">http://msdn.microsoft.com/en-us/library/system.uri.aspx</a> an came across</p>
  
  <blockquote>
    <p>IRI and IDN processing in the Uri class can also be controlled using
    the System.Configuration.IriParsingElement,
    System.Configuration.IdnElement, and System.Configuration.UriSection
    configuration setting classes. The
    System.Configuration.IriParsingElement setting enables or disables IRI
    processing in the Uri class. The System.Configuration.IdnElement
    setting enables or disables IDN processing in the Uri class. The
    System.Configuration.IriParsingElement setting also indirectly
    controls IDN. IRI processing must be enabled for IDN processing to be
    possible. If IRI processing is disabled, then IDN processing will be
    set to the default setting where the .NET Framework 2.0 behavior is
    used for compatibility and IDN names are not used.</p>
  </blockquote>
  
  <p>Unfortunatly I was not able to find an example for the usage of System.Configuration.IriParsingElement, System.Configuration.IdnElement, and System.Configuration.UriSection. I've no clue how these are used...</p>
  
  <p>So basically, my problem comes down to: I want to enable IDN/IRI support in the URI class, but I can't figure out how to do this. The config-solution is not working for me, so I would like to try it by code, but can't figure out how. Btw. I would also like to know why the config thing isn't working ;)</p>