C#: Base64 Encode a String

C# code to encode a string to its equivalent string representation that is encoded with base-64 digits.
private string EncodeBase64(string s)
        {
            try
            {
                byte[] ascBytes = System.Text.ASCIIEncoding.ASCII.GetBytes(s);
                return System.Convert.ToBase64String(ascBytes);
            }
            catch (Exception e) { throw new Exception(e.Message); }
        }

Add comment

Reading Stuff

Information in this document subject to change without notice.
All Software source code published is for demonstration and knowledge sharing purposes only. The Code is supplied "as is" without warranty as to result, performance or merchantability. Use at your own risk.
The opinions expressed herein are the opinions of the author and do not reflect those of any other entity.