Dumping your code on us like that is rude: in future only give us the relevant fragment - the method the error occurs in at most.
But...look at your code:
FileStream fs = new FileStream(fileName, FileMode.Append, FileAccess.Write, FileShare.None);
StreamReader sr = new StreamReader(fs);
When you open a file for Append, you can;t read it:
FileMode Enumeration (System.IO)[
^]:
Quote:
Opens the file if it exists and seeks to the end of the file, or creates a new file. This requires FileIOPermissionAccess.Append permission. FileMode.Append can be used only in conjunction with FileAccess.Write. Trying to seek to a position before the end of the file throws an IOException exception, and any attempt to read fails and throws a NotSupportedException exception.
If you want to read the file, open it for Read, not Append or Write.