我使用c#在asp.net中编写代码删除我计算机中的文件,但它没有删除请帮助我谢谢你。这是我的代码,我写在按钮点击事件中
string path = "E:\\sasi\\delt.doc";
FileInfo myfileinf = new FileInfo(path);
myfileinf.Delete();
Run Code Online (Sandbox Code Playgroud)
public void DeleteFileFromFolder(string StrFilename)
{
string strPhysicalFolder = Server.MapPath("..\\");
string strFileFullPath = strPhysicalFolder + StrFilename;
if (IO.File.Exists(strFileFullPath)) {
IO.File.Delete(strFileFullPath);
}
}
Run Code Online (Sandbox Code Playgroud)