System.Text.Encoding to convert string to Base64.
The conversion involves two processes:
i) First convert string to a byte array
ii) Then use the Convert.ToBase64String() method to convert the byte
array to a Base64 string
string str="Hello World";
string str1="";
byte[] byt = System.Text.Encoding.UTF8.GetBytes(str);
// convert the byte array to a Base64 string
str1 = Convert.ToBase64String(byt);
0 comments:
Post a Comment