tin pro

tin pro

  • NA
  • 4
  • 0

File conversion, select the encoding that makes your doument readable

Mar 7 2012 9:11 PM
Code is used for Encrypt file word(doc).
public void encrypt    ()
{   
            TripleDESCryptoServiceProvider tdes = null;
            string filename=@"C:\\test.doc"
            string encContent = @"C:\\encrypttest.doc";
            FileStream fin = new FileStream(fileName, FileMode.Open, FileAccess.Read);
            FileStream fout = new FileStream(encContent, FileMode.OpenOrCreate, FileAccess.Write);
            byte[] buff = new byte[10000];
            int lenread;     
            try
            {
                tdes = new TripleDESCryptoServiceProvider();
                CryptoStream encStream = new CryptoStream(fout, tdes.CreateEncryptor(), CryptoStreamMode.Write);
                Console.WriteLine("\nEncrypting content ... ");
                while ((lenread = fin.Read(buff, 0, 10000)) > 0)
                {
                    encStream.Write(buff, 0, lenread);
                }
                encStream.Close();      
                fin.Close();
                fout.Close();   
            }
            catch (Exception)
            {
            }               
}
After  file "encryptest.doc" is created.I open "crypttest.doc" in Word.Word display message "File conversion, select the encoding that makes your doument readable.Text encoding:".help please how do i disable or skip error message