delete files in folder thru asp.net
Hi
I know that this q has been asked before, but the new forum gives me noting when i search for this Q.
I have a asp.net application (vb) that creates a .xml-file in a folder on my server based on the selection the user makes.
is it possible for my app to check the folder and delete any files in it before creating the new .xml-file.
Do i need to set any permissions on the folder on the server to allow this or in IIS?
thanks
Re: delete files in folder thru asp.net
You will need to give the IUSER nd possibly the ASPNET account write permissions on the folder you wish to modify. You will also need to import the System.IO namespace
Code:
Dim dir As Directory
Dim dirfile As File
Dim strFiles() As String
Dim i As Integer
If dir.Exists(strDirectoryPath) Then
strFiles = dir.GetFiles(strDirectoryPath)
For i = 0 To UBound(strFiles)
dirfile.Delete(strFiles(i))
Next
End If
Re: delete files in folder thru asp.net