转 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

posted on 2018-12-13 13:36  Ssumer  阅读(10395)  评论(0编辑  收藏  举报

导航