Trying to use file encryption but am getting an error with File.Encrypt(FileName) returning an exception
<p>I tried codeproject help as well as MSDN but no success. Here is a copy of my test code returning an exception:</p>

<pre><code>    private void button2_Click(object sender, EventArgs e)
    {
        File.Decrypt("Text.pvf");
        string[] DataFile = File.ReadAllLines("Text.pvf");
        if (DataFile[5] == "6")
            MessageBox.Show("Encrypt/Decrypt successful");
       //Application.Exit();
    }

    private void button1_Click(object sender, EventArgs e)
    {
        string[] DataFile = new string[6];
        DataFile[0] = "1";
        DataFile[1] = "2";
        DataFile[2] = "3";
        DataFile[3] = "4";
        DataFile[4] = "5";
        DataFile[5] = "6";
        File.WriteAllLines("Text.pvf", DataFile);

        File.Encrypt("Text.pvf");
</code></pre>

<p>At the line: "<code>File.Encrypt("Text.pvf");</code>", I get an IOException and it says:'The request is not supported.'. Now the button1 method is called first. I do not know why this error comes up.</p>

<p>My pc: Windows7 64bit, .net 4.0, file system is NTFS as needed for File.Encryption method.</p>

<p>Please copy and paste my code to see if you can maybe spot the error. Perhaps I am missing something. Please help</p>
