title: C# Equivalent of Python's urlsafe_b64encode
body: <p>I am trying to build an ASP.NET MVC application, which will use <a href="https://github.com/globocom/thumbor" rel="nofollow">Thumbor</a> as a photo resizing backend, but have been running into problems with the security. Thumbor uses a SHA1 HMAC hash as a security system, which is based on the URL. So, the URL may look like:</p>
  
  <pre><code>http://thumbor-server/1234567890123456789012345678/300x200/smart/path/to/image.jpg
  </code></pre>
  
  <p>1234567890123456789012345678 being the hmac made up of a secret key and the 300...image.jpg section...</p>
  
  <p>anyway, i can create the HMAC value alright, or at least i think i can, but when generating the URL, Thumbor sugests using the urlsafe_base64encode function from Python. I have tried System.Convert.ToBase64String, but thats not working, and url encoding the string does not work either. By "not working", i mean Thumbor is telling me the URL is malformed. There is not much to go by... </p>
  
  <p>So, is there an equivalent? and if not, how would one go about generating a string the way it does? </p>