我的番茄炒蛋
生活如此精彩,挑战无处不在!

导航

 
编码
public string EncodeBase64(string code_type,string code)
{
string encode = "";
byte[] bytes = Encoding.GetEncoding(code_type).GetBytes(code);
try
{
encode = Convert.ToBase64String(bytes);
}
catch
{
encode = code;
}
return encode;
}
解码
public string DecodeBase64(string code_type,string code)
{
string decode = "";
byte[] bytes = Convert.FromBase64String(code);
try
{
decode = Encoding.GetEncoding(code_type).GetString(bytes);
}
catch
{
decode = code;
}
return decode;
}
posted on 2005-09-09 09:51  bluesky  阅读(461)  评论(0编辑  收藏  举报