title: Posting Html with images (WYSIWYG) to ASP.net core controller
body: <p>I'm having trouble posting my wysiwyg content to my controller in asp.net core.  I can't seem to get any value from the form editor.  The value for the Content property comes to the controller as null.  I'm using the summernote form editor to handle my richtext box editor.</p>
  
  <p><a href="https://i.stack.imgur.com/kFCQ0.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/kFCQ0.png" alt="This is the wysiwyg editor i&#39;m using"></a>
  <a href="https://i.stack.imgur.com/mpajo.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/mpajo.png" alt="enter image description here"></a></p>
  
  <p>Here is my code</p>
  
  <pre><code>public class Editor
  {        
      public int EditorId { get; set; }
      public string Content { get; set; }
  }
  </code></pre>
  
  <p>Controller:</p>
  
  <pre><code> [HttpPost]
      [ValidateAntiForgeryToken]
      public async Task&lt;IActionResult&gt; Create(Editor editor)
      {
          if (ModelState.IsValid)
          {
                _context.Add(editor);
                await _context.SaveChangesAsync();
                return RedirectToAction(nameof(Index));
          }
          return View(editor);
      }
  </code></pre>
  
  <p>View:</p>
  
  <pre><code>    &lt;h2&gt;Create&lt;/h2&gt;
  
  &lt;h4&gt;Editor&lt;/h4&gt;
  &lt;hr /&gt;
  &lt;div class="row"&gt;
      &lt;div class="col-md-4"&gt;
          &lt;form asp-action="Create"&gt;
              &lt;div asp-validation-summary="ModelOnly" class="text-danger"&gt;&lt;/div&gt;
              &lt;div class="form-group"&gt;
                  &lt;label asp-for="Content" class="control-label"&gt;&lt;/label&gt;
                  &lt;textarea asp-for="Content" id="summernote" name="editordata"&gt;&lt;/textarea&gt;
                  &lt;span asp-validation-for="Content" class="text-danger"&gt;&lt;/span&gt;
              &lt;/div&gt;
              &lt;div class="form-group"&gt;
                  &lt;input type="submit" value="Create" class="btn btn-default" /&gt;
              &lt;/div&gt;
          &lt;/form&gt;
      &lt;/div&gt;
  &lt;/div&gt;
  
  &lt;div&gt;
      &lt;a asp-action="Index"&gt;Back to List&lt;/a&gt;
  &lt;/div&gt;
  
  @section Scripts {
  
      &lt;script&gt;
          $(document).ready(function () {
              $('#summernote').summernote();
          });
      &lt;/script&gt;
      @{await Html.RenderPartialAsync("_ValidationScriptsPartial");}
  
      &lt;script src="http://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.js"&gt;&lt;/script&gt;
      &lt;script src="http://netdna.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.js"&gt;&lt;/script&gt; 
      &lt;script src="http://cdnjs.cloudflare.com/ajax/libs/summernote/0.8.9/summernote.js"&gt;&lt;/script&gt;
  
  }
  
  @section Styles{ 
      &lt;!-- include libraries(jQuery, bootstrap) --&gt;
      &lt;link href="https://netdna.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.css" rel="stylesheet"&gt;
      &lt;!-- include summernote css/js --&gt;
      &lt;link href="http://cdnjs.cloudflare.com/ajax/libs/summernote/0.8.9/summernote.css" rel="stylesheet"&gt;
  }
  </code></pre>
  
  <p>So the issue is when I post the form it's gets to the controller but the content comes over as null.  I'm not sure how to post the content</p>
  
  <p>Here are my thoughts, I'm thinking i'm missing a some attribute that allows html to come over the wire to my controller, but all the reserach i've found is that asp.net core doesn't require that.  Or I need to handle this type of request in the middleware pipeline, but that doesn't make much sense since it's just html strings i'm sending over the wire to the controller.  </p>