日期:2014-05-19  浏览次数:20796 次

怎么把byte[]转换成base64的byte[]?
我用binaryreader读取了一个二进制的内容,怎么把这个二进制的内容换成base64的二进制内容。
public   byte[]   getBase64(byte[]   content)
{
System.Text.ASCIIEncoding   asc   =   new   System.Text.ASCIIEncoding();
byte[]   b;
string   strBase64;

strBase64   =   System.Convert.ToBase64String(content);
b   =   asc.GetBytes(strBase64);

return   b;
}

我这么写对吗?好像结果不符合base64。

------解决方案--------------------
b = asc.GetBytes(strBase64);
===
b = Convert.FromBase64String( strBase64 )
------解决方案--------------------
ToBase64Transform