当我删除目录(由其他程序使用)时,请删除异常 [英] hoe remove the Exception when i delete the directory (used by other program)

查看:126
本文介绍了当我删除目录(由其他程序使用)时,请删除异常的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

删除目录时删除异常(给其他程序使用该异常)

我的代码是这个

如果(Directory.Exists(@"C:\\ WinDirectory"))
Directory.Delete(@"C:\ WinDirectory",true);

编写什么代码,以便在asp,net中使我们的目录每次删除

hoe remove the Exception when i delete the directory (give the Exception used by other program)

my code is this

if (Directory.Exists(@"C:\\WinDirectory"))
Directory.Delete(@"C:\WinDirectory", true);

what code write so that in asp,net so that our directory deleted each time

推荐答案

如果该目录正在被另一个应用程序使用,则您将无法使用的例外.但是,您可以处理该异常.
If the directory is being used by another application then you can''t get ride of the Exception. You can handle the exception though.


能否请您提及上面代码中的异常?
Could you please mention the exception that you are getting in the above code?


可能是您的错误"重新获得是因为ASP.Net需要更多权限才能与OS交互,所以您应该开始检查IIS的设置,请看这里

IIS安全性
Probably the error you''re getting is because ASP.Net needs more permissions to interact with the OS, you should start checking the setting for IIS, look here

IIS Security


这篇关于当我删除目录(由其他程序使用)时,请删除异常的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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