Skip to content

Instantly share code, notes, and snippets.

View tig's full-sized avatar

Tig tig

View GitHub Profile
@tig
tig / Utils.cs
Created February 1, 2012 08:24
Base64 conversion
public static string ToBase64(string encode) {
Byte[] btByteArray = null;
System.Text.UTF8Encoding encoding = new System.Text.UTF8Encoding();
btByteArray = encoding.GetBytes(encode);
string sResult = System.Convert.ToBase64String(btByteArray, 0, btByteArray.Length);
sResult = sResult.Replace("+", "-").Replace("/", "_");
return sResult;
}
public static string FromBase64(string decode) {