private string EncodeData(string sData) { try { byte[] toencodeData = new byte[sData.Length]; toencodeData = System.Text.Encoding.UTF8.GetBytes(sData); //encodes all the characters into a specified sequence of bytes string encodedData = Convert.ToBase64String(toencodeData); return encodedData; } catch (Exception ex) { throw new Exception(Error in EncodeData + ex.Message); } } public string DecodeData(string sData) { System.Text.UTF8Encoding utf8encoder = new System.Text.UTF8Encoding(); System.Text.Decoder utf8Decoder = utf8encoder.GetDecoder(); byte[] tobedecode_byte = Convert.FromBase64String(sData); //converts the specified System.String,which encode binary data as base 64 digits,to an equivalent 8-bit unsigned integer arrayint char_Count = utf8Decoder.GetCharCount(tobedecode_byte, 0, tobedecode_byte.Length);//calaculates the number of characters produced by decodeing a sequence of bytes from the specified byte arraychar[] decoded_char = new char[char_Count]; utf8Decoder.GetChars(tobedecode_byte, 0, tobedecode_byte.Length, decoded_char, 0); //Decodes a sequence of bytes from the specified byte array and any butes in the internal buffer into the specified character array string resultstring = new String(decoded_char); return resultstring; }