Results 1 to 3 of 3

Thread: delete files in folder thru asp.net

  1. #1

    Thread Starter
    Hyperactive Member onerrorgoto's Avatar
    Join Date
    Aug 1999
    Location
    Sweden
    Posts
    330

    Resolved 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
    Last edited by onerrorgoto; Dec 10th, 2004 at 06:15 AM. Reason: Solved
    Onerrorgoto

    Dont be to optimistic, the light at the end of the tunnel might be a train

  2. #2
    Addicted Member rdove's Avatar
    Join Date
    Dec 2002
    Location
    Indianapolis
    Posts
    251

    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
    ~Ryan





    Have I helped you? Please Rate my posts.

  3. #3

    Thread Starter
    Hyperactive Member onerrorgoto's Avatar
    Join Date
    Aug 1999
    Location
    Sweden
    Posts
    330

    Smile Re: delete files in folder thru asp.net

    Thank you
    Onerrorgoto

    Dont be to optimistic, the light at the end of the tunnel might be a train

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width