简体   繁体   中英

Access Denied to any folder, C#

Getting this strange error.

In C#, I write to a file (txt) whose location I provide at run-time.

The problem is that whatever location I provide, It returns an error: Access to "..path.." is denied.

I checked the permissions, but the required permissions are set.

My code snippet

folderBrowserDialog.ShowDialog();

StreamWriter path = new StreamWriter(folderBrowserDialog.SelectedPath);
.
.
.

Any known issues or something I am missing?

Thanks

You should pass a file name to StreamWriter. It looks as if you're passing a folder name.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM