转 c#中 base64字符串与普通字符串互转

https://blog.csdn.net/hwt0101/article/details/79758912

转成 Base64 形式的 System.String:
    string a = "base64字符串与普通字符串互转";  
    byte[] b = System.Text.Encoding.Default.GetBytes(a);      
    //转成 Base64 形式的 System.String  
    a = Convert.ToBase64String(b);  
    Response.Write(a);  
 
转回到原来的 System.String:


    byte[] c = Convert.FromBase64String(a);  
    a = System.Text.Encoding.Default.GetString(c);  
    Response.Write(a);

 内容来源网上

https://www.cnblogs.com/xskblog/p/6179689.html

猜你喜欢

转载自www.cnblogs.com/MasterLin/p/10113499.html