【发布时间】:2014-02-20 16:32:01
【问题描述】:
这似乎很简单,但我似乎无法找出问题所在
public static string destinationFile;
[STAThread]
private static void Main(string[] args)
{
//doing something and then calling convert method
}
private static void convert(object source, FileSystemEventArgs f)
{
if (check(FileName))
{
//doing something
XmlTextWriter myWriter = new XmlTextWriter(destinationFile, null);
//doing something
}
}
private static bool check(string filename)
{
//check the file and return a boolean result
if (sometest)
{
destinationFile = @"d:/GS";
return true;
}
return false;
}
当我运行它时,我得到:
The process failed:
System.UnauthorizedAccessException: Access to the path is denied
请问我哪里出错了。
【问题讨论】:
-
以
Administrator运行您的程序并重试 -
我用的是windows xp,已经是管理员帐号了
-
您确定管理员有权访问该文件夹吗?
-
检查你是否有完全的访问权限——读/写目标文件
-
是的,我之前有一个疑问,然后我将每个人都放在了该文件夹中,并具有完全访问权限