title: Reliably checking if a string is base64 encoded in .Net
body: <p>Before I start: Yes, I have checked the other questions and answers on this topic both here and elsewhere. </p>
  
  <p>I have found an example string that the .Net will base64 decode even though it isn't actually base64 encoded. Here is the example: </p>
  
  <p><em>Rhinocort Aqueous 64mcg/dose Nasal Spray</em></p>
  
  <p>The .Net method Convert.FromBase64String does not throw an exception when decoding this string so my IsBase64Encoded method happily returns true for this string.</p>
  
  <p>Interestingly, if I use the cygwin base64 -d command using this string as input, it fails with the message <em>invalid input</em>. </p>
  
  <p>Even more interestingly, the source that I thought that belongs to this executable (<a href="http://libb64.sourceforge.net/" rel="nofollow">http://libb64.sourceforge.net/</a>) "decodes" this same string with the same result as I am getting from the .Net Convert.FromBase64String. I will keep looking hoping to find a clue elsewhere but right now I'm stumped.</p>
  
  <p>Any ideas?</p>