Base64 Decoding

K

Kuldeep

Hi All,

Could you please give me some guidelines on dealing with
Base64 encoded string.
The actual purpose is to decode Base64 Encoded string
and stream the data to a browser so that it can be viewed
in a web application

Regards,
Kuldeep
 
G

Guest

public static string Base64Encode(string data) {
byte[] myBytes = Encoding.ASCII.GetBytes(data.Trim().ToCharArray());
return Convert.ToBase64String (myBytes);
}

public static string Base64Decode(string data) {
try {
return Encoding.ASCII.GetString (Convert.FromBase64String (data.Trim()));
} catch {
// Invalid String!
return "";
}
}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top