如何删除文件夹中的垂直文件 [英] How to Delete Perticular file in Folder

查看:80
本文介绍了如何删除文件夹中的垂直文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

亲爱的朋友,

在这里,我开发了一个Web应用程序,并iam将Pdf文件保存并将其存储在一个文件夹中.iam删除了垂直记录.iam存储在文件夹路径中的文件也应该旨在获得一些Exception错误.

代码:

Dear Friends,

Here i have Developed one web application and iam saving Pdf files and iam storing that file in one folder.While iam deleting the perticular record.That file which iam storing in folder path it should also but aim getting some Exception error.

The Code:

else if (e.CommandName == "Delete")
     {
         string filename;
         int index = Convert.ToInt32(e.CommandArgument);
         objinfo.IntInformationID = index;
         DataSet ds = objinfo.DeletePdfDocument();
         string strPath = string.Empty;
         filename = ds.Tables[0].Rows[0]["strDocument"].ToString();
         strPath = Server.MapPath("Documents") + "\\" + filename;
         File.Delete(strPath);

         objinfo.GetinfoDelete();
         Response.Redirect("frmManageCode.aspx");
     }





错误是:拒绝访问路径``D:\ AnilKumarBackUp \ Development Center \ USAID_EMISICT \ ICT_Forms \ Documents \ DPO12334.pdf''.


如果有任何有关此方面的信息,请与我分享.


问候,

AnilKumar.D





Error is: Access to the path ''D:\AnilKumarBackUp\Developement Center\USAID_EMISICT\ICT_Forms\Documents\DPO12334.pdf'' is denied.


if any information regarding this please share with me.


Regards,

AnilKumar.D

推荐答案

由您的pdf 文件组成的folder 是否具有要删除的permission ?
请检查并grant permission 到文件夹.
另一种可能性是您的文件已被使用.


如果有解决方案,请回答.

谢谢
AShish
Do the folder which consists of your pdf file have permission for delete??
please check and grant permission to the folder.
another possibility is that your file is already in use.


make it answer if you got your solution.

Thanks
AShish


这可能是因为当您请求网页时,您的网络服务器负责提供服务,此处的用户是您的网络服务器,并且它可能无权从该文件夹中删除文件.
尝试将保存文件的文件夹更改为Web根文件夹的某个子目录中的某个文件夹,或者将Web服务器的读写权限授予该特定文件夹.
This can be because when you request a web page, your webserver is responsible for serving and here the user is your web server and it may not have permission to delete a file from this folder.
Try to change the folder where you save the file to some folder in some subdirectory of your web root folder or give read write permission for your webserver to that particular folder.


这篇关于如何删除文件夹中的垂直文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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