C#: Decode Base64 Encoded String

C# code to dencode a Base64 encoded string to its equivalent string representation.

private string DecodeBase64(string s)
        {
            try
            {
                byte[] ascBytes = System.Convert.FromBase64String(s);
                return System.Text.ASCIIEncoding.ASCII.GetString(ascBytes);
            }
            catch (Exception e) { throw new Exception(e.Message); }
        }

Leave a Comment