驱动器Windows中拒绝访问的问题 [英] Problem With Access Denied in Drive Windows

查看:331
本文介绍了驱动器Windows中拒绝访问的问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


i有一个程序,当你单击按钮时,它将创建一个文件夹并将文件移动到文件夹并删除它,这是我写的代码,让它访问它的这个

Hi i have a program and in that when you click the button it will be create a folder and move the file to folder and delete it and this is the code i wrote for give it access its this

File.SetAttributes(Application.StartupPath, FileAttributes.Normal);



在所有硬盘中使用此代码我可以这样做,但在Windows驱动器(驱动器:C)我不能这样做,它说访问被拒绝

我该怎么做才能让我在驱动器窗口中访问它(驱动器:C) ?

我希望访问文件夹和文件

With Respect


with this code in all hard drive i can do it but in windows drive (drive: C) i can't do it and it says access denied
what should i do to it give me an access to it in drive windows(Drive: C)?
and i want access for folder and file
With Respect

推荐答案

创建一个将拥有的用户访问C盘并在配置文件中模拟该用户,如下所示。

< identity impersonate =trueusername =Usernamepassword =password>
Create a user which will have the access to C drive and impersonate that user in your config file as below.
<identity impersonate="true" username="Username" password="password">


有两种方法可以做到。

1)如果以管理员模式启动visual studio,它将允许你要创建f Windows上安装的OL和文件驱动器

2)您可以添加Application Manifest文件(app.manifest)文件并检查以下标签 -

< requestedexecutionlevel level =asInvokeruiaccess =false>

设置uiAccess = true,因此每次您的应用程序将在管理模式下执行,您将能够创建或运行任何文件和文件夹。
There are 2 ways you can do it.
1) If you start your visual studio in administrator mode it will allow you to create folders and files on windows mounted drive
2) you can add Application Manifest file(app.manifest) file and check the following tag-
<requestedexecutionlevel level="asInvoker" uiaccess="false">
set the "uiAccess=true" so every time your application will executed under admin mode and you will be able to create or operate any files and folders.


这篇关于驱动器Windows中拒绝访问的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆