写入程序文件时访问被拒绝

写入程序文件时访问被拒绝

本文介绍了读取/写入程序文件时访问被拒绝的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在程序文件的自定义文件夹中安装了一个小程序,但是当我尝试读取或写入操作所需的文件时,该程序将引发Access Denied Exeption.我当然要在用户许可下提升程序.

I have a small program that is installed in a custom folder in the program files, but when I tried to read or write to files that are needed to operate, the program raises an Access Denied Exeption. How can I elevte the program, with the user's permission of course.

推荐答案

解决读取时访问被拒绝的异常.请指定文件访问为已读,这将解决读取时访问被拒绝的异常

To resolve the Access denied exception while reading. Please specify the file access as read, that will resolve the access denied exception while reading

e.g. fs = new FileStream(fileName, FileMode.Open, FileAccess.Read);

这篇关于读取/写入程序文件时访问被拒绝的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-29 11:18