# C1.WPF.SpellChecker.SpellDictionaryBase.LoadAsync

## Content

<div class="doc-site-dotnet-api-container">



<h1 id="C1_WPF_SpellChecker_SpellDictionaryBase_LoadAsync_" data-uid="C1.WPF.SpellChecker.SpellDictionaryBase.LoadAsync*">LoadAsync Method
</h1>
<div class="markdown level0 summary"></div>
<div class="markdown level0 conceptual"></div>



<a id="C1_WPF_SpellChecker_SpellDictionaryBase_LoadAsync_" data-uid="C1.WPF.SpellChecker.SpellDictionaryBase.LoadAsync*"></a>
<h4 id="C1_WPF_SpellChecker_SpellDictionaryBase_LoadAsync_System_String_" data-uid="C1.WPF.SpellChecker.SpellDictionaryBase.LoadAsync(System.String)">LoadAsync(string)</h4>
<div class="markdown level1 summary"><p>Loads the dictionary from a Uri pointing to the compressed dictionary data.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="declaration">Declaration</h5>
<div class="codewrapper">
  <pre><code class="lang-csharp hljs">public void LoadAsync(string uri)</code></pre>
</div>
<div class="codewrapper">
  <pre><code class="lang-vbnet hljs">Public Sub LoadAsync(uri As String)</code></pre>
</div>
<h5 class="parameters">Parameters</h5>
<table class="table table-bordered table-condensed">
  <thead>
    <tr>
      <th>Type</th>
      <th>Name</th>
      <th>Description</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.string">string</a></td>
      <td><span class="parametername">uri</span></td>
      <td><p>Uri that points to the compressed dictionary data.</p>
</td>
    </tr>
  </tbody>
</table>
<h5 id="C1_WPF_SpellChecker_SpellDictionaryBase_LoadAsync_System_String__remarks">Remarks</h5>
<div class="markdown level1 remarks"><p>When this method completes, it fires the <a class="xref" href="C1.WPF.SpellChecker.SpellDictionaryBase.LoadCompleted.html">LoadCompleted</a> event.</p>
</div>


<a id="C1_WPF_SpellChecker_SpellDictionaryBase_LoadAsync_" data-uid="C1.WPF.SpellChecker.SpellDictionaryBase.LoadAsync*"></a>
<h4 id="C1_WPF_SpellChecker_SpellDictionaryBase_LoadAsync_System_Uri_" data-uid="C1.WPF.SpellChecker.SpellDictionaryBase.LoadAsync(System.Uri)">LoadAsync(Uri)</h4>
<div class="markdown level1 summary"><p>Loads the dictionary from a Uri pointing to the compressed dictionary data.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="declaration">Declaration</h5>
<div class="codewrapper">
  <pre><code class="lang-csharp hljs">public void LoadAsync(Uri uri)</code></pre>
</div>
<div class="codewrapper">
  <pre><code class="lang-vbnet hljs">Public Sub LoadAsync(uri As Uri)</code></pre>
</div>
<h5 class="parameters">Parameters</h5>
<table class="table table-bordered table-condensed">
  <thead>
    <tr>
      <th>Type</th>
      <th>Name</th>
      <th>Description</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.uri">Uri</a></td>
      <td><span class="parametername">uri</span></td>
      <td><p>Uri that points to the compressed dictionary data.</p>
</td>
    </tr>
  </tbody>
</table>
<h5 id="C1_WPF_SpellChecker_SpellDictionaryBase_LoadAsync_System_Uri__remarks">Remarks</h5>
<div class="markdown level1 remarks"><pre><code>&lt;p&gt;When this method completes, it fires the &lt;xref href=&quot;C1.WPF.SpellChecker.SpellDictionaryBase.LoadCompleted&quot; data-throw-if-not-resolved=&quot;false&quot;&gt;&lt;/xref&gt; event.&lt;/p&gt;
&lt;p&gt;
    &lt;b&gt;LoadAsync&lt;/b&gt; downloads the dictionary by creating a &lt;xref href=&quot;System.Net.WebClient&quot; data-throw-if-not-resolved=&quot;false&quot;&gt;&lt;/xref&gt; object and calling
</code></pre>
<p>its <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.net.webclient.openreadasync#system-net-webclient-openreadasync(system-uri)">OpenReadAsync(Uri)</a> method. This call will fail if the server is not configured
to serve the file extension used by the dictionary file. If this happens, you have a few easy ways to
solve the problem:</p>
<ul><li>Rename the dictionary file to use an extension that is allowed by IIS.
A good choice would be to use the 'zip' extension (dictionary files really are zip files).
This is the easiest option because it does not require any changes to the server and no
server-side code.</li><li>If you do not want to rename the file, configure IIS to allow serving &quot;dct&quot; files.
This is done by adding the &quot;dct&quot; extension to the list of supported MIME types on the
server. The drawback with this option is that it requires changes to the server
configuration.</li><li>Write a web service that reads the dictionary file and returns its contents as
a byte array. Then open a <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.io.memorystream">MemoryStream</a> using the array as the initial data
and use the main dictionary's <a class="xref" href="C1.WPF.SpellChecker.SpellDictionaryBase.Load.html#C1_WPF_SpellChecker_SpellDictionaryBase_Load_System_IO_Stream_">Load(Stream)</a> method to load the dictionary from the
<a class="xref" href="https://learn.microsoft.com/dotnet/api/system.io.memorystream">MemoryStream</a>. The drawback with this option is that it requires additional
code on the client as well as on the server side of the application.</li></ul>
</div>
</div>
