Unable to Create or Write to a file as standard user

﹥>﹥吖頭↗ 提交于 2019-12-04 19:45:02

If you really want to, you can add a manifest that causes your application to require UAC elevation when it is launched, but more often than not that's not what you should do.

More likely, you're writing to a path you shouldn't be. User mode applications should only write to the current users folders or the C:\Users\Public folder, and things like logs should go in C:\Users\Current User Name\Application Data\Your Program Name\. To get the ApplicationData path use Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData). Or if you want to have the file shared by all users, use Environment.SpecialFolder.CommonApplicationData.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!