V
Valeria
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!
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!