title: Send base64 image string using Ajax to a .NET WebService - I get a different string
body: <p>I am trying to submit a base64 image string to a .NET webservice. I tried in two approaches:</p>
  
  <p>1) Getting the string from a preview image src attribute</p>
  
  <p>2) Getting the string  from within a DIV that I insert the base64 string into</p>
  
  <p>note: When the string is in the preview src image, I can see the image, so the string stored there is fine. </p>
  
  <p>I tried transfering it to the WebService with and without encodeURIComponent.</p>
  
  <pre><code>var formData = {
          screenshot: $(".uploadimage").attr("src")   
      };
  </code></pre>
  
  <p>or</p>
  
  <pre><code>var formData = {
         screenshot:$("#base64imagepreview").html()
  }
  </code></pre>
  
  <p>I stringify the data before using the ajax request to the web service:</p>
  
  <pre><code>data: JSON.stringify(formData),
  </code></pre>
  
  <p>My problem is that the string of the base64 image is always different then the one the web service gets. </p>
  
  <p>How can I transfer the string so it would be the same and it won't fail my <code>base64ToImage</code> function.</p>
  
  <p>Here's part of the string that is changed:</p>
  
  <pre><code>P2Kxgxby0yA3NeQqxtuEjQEO7HcuDsD8qNl
  </code></pre>
  
  <p>Changes to this (this is just a part of the chance, the converted string continues):</p>
  
  <pre><code>P2...LWG1AUyHSvfONznr/
  </code></pre>
  
  <p>Something is changing and I have no idea why. <strong>The string breaks after P2</strong>.</p>
  
  <p>It might be due to a maximum attribute length for the string (maxRequestLength) but I am not sure.</p>
  
  <p>The original string is <strong>56,331 bytes</strong>. The one that the webservice consumed is <strong>32,768 bytes</strong>. Due to the three dots, I assume that .NET trims the string.</p>
  
  <p>I am using regular webservice, not WCF.</p>
  
  <p>Update: It tried to increase the <code>maxRequestLength</code> but it didn't solve the probolem.</p>