I think the exception probably speaks for itself, your application is trying to write to a directory when it doesn't necessarily have the permissions to do so. As a safety precaution the C:\ directory is likely protected by administrator rights. In order to write to that location you would need to run the application as administrator.
If the directory that you're writing your file to is arbitrary then consider using a different one, somewhere which isn't likely to cause security or permission issues. You can use
Environment.GetFolderPath()[
^] to acquire paths to common directories. A good example might be the desktop, the documents folder, or even having a save file dialog open up so the user can choose the location?