/// <summary>
/// Base64编码
/// </summary>
/// <param name="str"></param>
/// <returns></returns>
protected string StringToBase64(string str)
{
try
{
byte[] by = Encoding.Default.GetBytes(str.ToCharArray());
str = Convert.ToBase64String(by);
}
catch
{
}
return str;
}
/// <summary>
/// Base64解码
/// </summary>
/// <param name="str"></param>
/// <returns></returns>
protected string Base64ToString(string str)
{
try
{
byte[] by = Convert.FromBase64String(str);
str = Encoding.Default.GetString(by);
}
catch
{
}
return str;
}
/// Base64编码
/// </summary>
/// <param name="str"></param>
/// <returns></returns>
protected string StringToBase64(string str)
{
try
{
byte[] by = Encoding.Default.GetBytes(str.ToCharArray());
str = Convert.ToBase64String(by);
}
catch
{
}
return str;
}
/// <summary>
/// Base64解码
/// </summary>
/// <param name="str"></param>
/// <returns></returns>
protected string Base64ToString(string str)
{
try
{
byte[] by = Convert.FromBase64String(str);
str = Encoding.Default.GetString(by);
}
catch
{
}
return str;
}