Quantcast
Channel: Visual C# forum
Viewing all articles
Browse latest Browse all 31927

UnAuthorizedAccessException. How to attain the permissions to create files/folders in system drive?

$
0
0

Hello everybody,

I have a folder in C drive and I wanted to pass the text from richTextBox to the file. The following code to print the file works fine:

System.IO.StreamWriter file = new System.IO.StreamWriter(temp);
                    file.WriteLine(this.NotePad.Rtf);
                    file.Close();

where temp is the folder destination.

But it gives me an exception that I don't have enough privileges to alter this folder, though I am the administrator. Is there any way I can get permission to write/read to/from the system drive or special folders.

I hope that you reply on your earliest. Thank you for your time.


Viewing all articles
Browse latest Browse all 31927

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>