2012-07-10 92 views
0

我有一个问题,我想要保存在使用asp.net目录中的HTML文件。 但是,当我尝试这样做, 我得到了一个安全例外如下。文件权限,同时保存到服务器的HTML

7/10/2012 12:03:54 AM,http://www.teddytank.com/admin/AddNewsLetter.aspx? 
     nid=3,System.IO.IOException: The process cannot access the  
file 'D:\hosting\7837152\html\ne\newsletter06_07_2012_T_37.html' because it is being 
used by another process. 
at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath) 
at System.IO.FileInfo.Delete() 
at Admin_AddNewsLetter.Submit_Click(Object sender, EventArgs e) 
7/10/2012 12:04:45 AM,http://www.teddytank.com/admin/AddNewsLetter.aspx?  
nid=3,System.IO.IOException: The process cannot access the file ' 
D:\hosting\7837152\html\ne\newsletter06_07_2012_T_37.html' because it is being used by 
another process. 
at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath) 
at System.IO.FileInfo.Delete() 
at Admin_AddNewsLetter.Submit_Click(Object sender, EventArgs e) 

请帮忙。 thanx提前。

+1

我们可以看到您的文件编写代码吗? – TheZ 2012-07-10 07:25:42

+0

错误状态为“因为它正在被另一个进程使用”:您确定没有其他人正在使用该文件吗? – Marco 2012-07-10 07:26:27

回答

0

您的文件正在被另一个进程使用,说明了所有内容,您必须检查谁在使用该文件,即如果您在另一个应用程序中打开了html文件,还请确保关闭了StreamWriter或FileStream (例如yourstreamwriter.close()),否则你会得到这个异常。