The GetAttachmentIdFromMediaId function is not robust enough. Sometimes the parsing of media_id as a base64 string fails with "incorrect padding string Exception".

The failure was because that .net code in gateway replaced '/' with '-'. Now I'm fixing it by adding alterchars to the b64decode command.
Merge pull request #3 from Azure/bug/base64

fixes a bug in base64 encoding.