string TempPath = "D:\\wwwroot\\a.txt";
if (File.Exists(Server.MapPath(TempPath)))
{
File.Delete(Server.MapPath(TempPath));
}//无报错,但是无法删除
//测试用↓string TempPath = "D:\\wwwroot\\a.txt";
aaa.Text = TempPath;
if (File.Exists(Server.MapPath(TempPath)))
{
File.Delete(Server.MapPath(TempPath));
bbb.Text = TempPath;
}
ccc.Text = TempPath;//aaa能取得值,bbb,ccc都没值!//请教高手
//注:我权限已经EveryOne完全控制
//顺便问一下:支持IO操作的最低权限是什么啊??
if (File.Exists(Server.MapPath(TempPath)))
{
File.Delete(Server.MapPath(TempPath));
}//无报错,但是无法删除
//测试用↓string TempPath = "D:\\wwwroot\\a.txt";
aaa.Text = TempPath;
if (File.Exists(Server.MapPath(TempPath)))
{
File.Delete(Server.MapPath(TempPath));
bbb.Text = TempPath;
}
ccc.Text = TempPath;//aaa能取得值,bbb,ccc都没值!//请教高手
//注:我权限已经EveryOne完全控制
//顺便问一下:支持IO操作的最低权限是什么啊??
aaa.Text = TempPath;
if (File.Exists(TempPath))
{
File.Delete(TempPath);
bbb.Text = TempPath;
}
ccc.Text = TempPath;
但是去掉了Server.MapPath问题依旧!顺便问一下:支持IO操作的最低权限是什么啊??我不想设置EveryOne完全控制
===================================
string TempPath = "D:\\wwwroot\\a.txt";
FileInfo info=new FileInfo(TempPath);
if(info.Exists)
{
File.Delete(TempPath);
}
每次上服务器时我也是调成EVERYONE。
只把ASPNET,NetWork Serivce,权限加上,应该就可以了