title: How to remove invalid characters from base64 string
body: <p>I am serializing a xml and compress to ToBase64String stores in the database as nvarchar,
  while loading decompress the string from 'FromBase64String' throws the error</p>
  
  <p>"The input is not a valid Base-64 string as it contains a 
  non-base 64 character, more than two padding characters, 
  or a non-white space character among the padding characters."</p>
  
  <p>I referred to this <a href="https://stackoverflow.com/questions/6309379/how-to-check-for-a-valid-base-64-encoded-string-in-c-sharp">How to check for a valid Base64 encoded string</a> but not worked for me ? is there anyway to remove unwanted characters from the string.</p>
  
  <p>below is a part of serialized string</p>
  
  <pre><code>5gAAAB+LCAAAAAAABADsvQdgHEmWJSYvbcp7f0r1StfgdKEIgGATJNiQQBDswYjN5pLsHWlHIymrKoHKZVZlXWYWQMztnbz33nvvvffee++997 
  </code></pre>