title: Pass long HTML string as parameter to Web API from MVC Controller
body: <p>I am working on development of Web API as well as MVC application. Now my requirement is to pass HTML as a string from MVC controller to Web API method.</p>
  <p>I have used the below code in my MVC application to call web service:</p>
  <pre><code> using (var client = new HttpClient())
          {
              byte[] Result = null;
  
              client.BaseAddress = new Uri(&quot;http://localhost:1004/&quot;);
  
              HttpResponseMessage Res = await client.GetAsync(string.Format(&quot;api/Method?htmlString={0}&quot;, htmlString));
  
              if (Res.IsSuccessStatusCode)
              {
                  Result = Res.Content.ReadAsByteArrayAsync().Result;
              }
  
              if (Result != null)
              {
                  //Work with byte array
              }
          }
  </code></pre>
  <p>Below is the declaration of my method in Web API</p>
  <pre><code>[HttpGet]
      [Route(&quot;api/Method&quot;)]
      public HttpResponseMessage Method(string htmlString)
      {
         try
         {
           //work with htmlString
          }
          catch (Exception ex)
          {
              HttpError err = new HttpError(ex.ToString());
              return Request.CreateResponse(HttpStatusCode.NotFound, err);   
          }
      }
  </code></pre>
  <p>But the above code does not work and I am geting an error</p>
  <p>Then I have implemented logging and found that the parameter <strong>htmlString</strong> in Web API is empty, which should not happen as I am passing my HTML</p>
  <p>I have even tried to Encode HTML in MVC and then pass it to Web API, but that is also not working.</p>
  <p>What can I do in this case?</p>
  <p><strong>[Edited]</strong>
  I have tried to pass simple HTML which is shown as below from MVC application and I got the value in Web API</p>
  <pre><code>&lt;html&gt;
  &lt;body&gt;
      Hello World.
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  <p>However it is not working with my long HTML</p>