Ask a Question related to ASP.NET Security, Design and Development.
-
Valeria #1
Delete File Asp.NET Error: File is used by another process
Please, help!
I have set Permission to Full Control to the user ASPNet_wp account to
my Security folder.
I have set UserName = "System" processModel in Machine.config
And when I want to delete File.txt I got the follow error:
The process cannot access the file
"c:\inetpub\wwwroot\MyApp\Security\File.txt"
because it is being used by another process."
My code is:
Dim strFilepath As String
Dim FileObject, oInStream, strOutput
strFilepath = Server.MapPath("seguridad/")
Dim Archivo As System.IO.File
'Crete the file
Archivo.Create(strFilepath & "File.txt")
'Write the file
Dim objStreamWriter As System.IO.StreamWriter
objStreamWriter = System.IO.File.AppendText("File.txt")
objStreamWriter.WriteLine(Trim(txtClave.Text))
objStreamWriter.Close()
objStreamWriter = Nothing
'Delete the File
If Archivo.Exists(strFilepath & "File.txt") Then
'This line causes an error!!!!
Archivo.Delete(strFilepath & "File.txt")
End If
Archivo = Nothing
Do I have to open the File in exclusive mode ?
If yes, I appreciate the code to do it... Thanks!
Valeria Guest
-
Error in delete file using NET:FTP module
I am very new to perl. I use following script to delete a file on ftp server. $ftpobj -> delete($fileName) or $newerr=1; print "cannot delete... -
The file is being used by some other process
hi , Am trying to read from and write to a same xml file.i have no prob when reading the xml file.but when i write to the same file i get the... -
File IO won't delete txt file
Hi, I just wrote this script so that when I change something in a list in the projector, this list is saved in an external txt file.. the problem... -
process .wav file?
I would like to play a very short sound effect( .wav file ) repeatedly. ############################################ aFile = File.new("foo.wav",... -
How to delete a file from the file system
Hi, Is there any module which has methods that can be used to delete a file from the filesystem in the windows NT environment. Thanks in... -
Naveen K Kohli #2
Re: Delete File Asp.NET Error: File is used by another process
CLose the hanlde on Archivo object.
Archivo.Close()
--
Naveen K Kohli
[url]http://www.netomatix.com[/url]
"Valeria" <valerial@frlp.utn.edu.ar> wrote in message
news:31acafac.0307100713.408967ce@posting.google.c om...> Please, help!
> I have set Permission to Full Control to the user ASPNet_wp account to
> my Security folder.
> I have set UserName = "System" processModel in Machine.config
> And when I want to delete File.txt I got the follow error:
>
> The process cannot access the file
> "c:\inetpub\wwwroot\MyApp\Security\File.txt"
> because it is being used by another process."
>
> My code is:
> Dim strFilepath As String
> Dim FileObject, oInStream, strOutput
> strFilepath = Server.MapPath("seguridad/")
> Dim Archivo As System.IO.File
>
> 'Crete the file
> Archivo.Create(strFilepath & "File.txt")
>
> 'Write the file
> Dim objStreamWriter As System.IO.StreamWriter
> objStreamWriter = System.IO.File.AppendText("File.txt")
> objStreamWriter.WriteLine(Trim(txtClave.Text))
> objStreamWriter.Close()
> objStreamWriter = Nothing
>
> 'Delete the File
> If Archivo.Exists(strFilepath & "File.txt") Then
> 'This line causes an error!!!!
> Archivo.Delete(strFilepath & "File.txt")
> End If
> Archivo = Nothing
>
> Do I have to open the File in exclusive mode ?
> If yes, I appreciate the code to do it... Thanks!
Naveen K Kohli Guest



Reply With Quote

