Yes you can. This is base64, you can convert it using the method
System.Convert.FromBase64String
, see
http://msdn.microsoft.com/en-us/library/system.convert.frombase64string.aspx[
^].
This will give you array of byte. Now you need to interpret this array as a string assuming known encoding using appropriate encoding class, for example,
UTF8
.
Step-by-step, all together:
string Utf8StringFromBase64(string base64) {
byte[] bytes = System.Convert.FromBase64String(base64);
System.Text.Encoding encoding = new System.Text.UTF8Encoding();
char[] chars = encoding.GetChars(bytes);
return new string(chars);
}
As
System.Text.Encoding
is a base class for all encodings, the code for different encodings will differ only in constructor.
—SA