/ Published in: C#
De-serializes a Base64 String back to it's original object. First x characters should indicate the byte length of the encoded data.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
public static object DeserializeBase64(string s) { // We need to know the exact length of the string - Base64 can sometimes pad us by a byte or two int p = s.IndexOf(':'); int length = Convert.ToInt32(s.Substring(0, p)); // Extract data from the base 64 string! byte[] memorydata = Convert.FromBase64String(s.Substring(p + 1)); object o = sf.Deserialize(rs); return o; }