aspnet_wp.exe has handle on directory being deleted

Discussion in 'ASP .Net' started by Chris McFarling, Sep 25, 2008.

  1. I have a basic aspx page for the user to select the month & year. They then
    click a button to generate a report. The following sequence happens:

    - Temp directory is created (if it exists already, it is deleted first)
    - A simple aspx file is built in code and written to the temp directory with
    a StreamWriter
    - A View Report button is displayed for the user


    The View Report button is a HyperLink control that targets a blank window.
    When clicked the temp aspx file in the temp directory is displayed in the
    window.

    Once the temp aspx file is accessed, if the user tries to run the report
    again, an error is thrown. It appears that aspnet_wp.exe has a handle on the
    temp directory which interferes with the following code:

    If Directory.Exists(strPath) = True Then
    Directory.Delete(strPath, True)
    End If
    Directory.CreateDirectory(strPath)
    ....
    dsDataSet.WriteXml(strPath & "\report.xml")
    ....
    objStreamWriter.Write(strHtml)


    The error only occurs the first time the report is run after viewing the
    file. The error is caused by the WriteXml command not having a directory to
    write to. So the directory gets deleted but it does not get recreated.
    Re-running the report again at that poit is successfull.

    Here's a summary of how to recreate the error:

    Run report = success
    Don't view file
    Re-run report = success
    View file
    Re-run report = failure
    Re-run report = success

    This appears to be an issue where aspnet_wp.exe has a handle on a
    file/directory that is part of the web application. Is there a way to keep
    hat from happening?
     
    Chris McFarling, Sep 25, 2008
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Chitra

    ASPnet_wp.exe and CSRSS.exe

    Chitra, Nov 7, 2003, in forum: ASP .Net
    Replies:
    0
    Views:
    453
    Chitra
    Nov 7, 2003
  2. Jarrod Hermer
    Replies:
    2
    Views:
    2,216
    kahlawat
    Jul 13, 2007
  3. prem
    Replies:
    1
    Views:
    1,626
    Shankara Narayanan
    Nov 3, 2004
  4. Replies:
    0
    Views:
    443
  5. Chumley the Walrus
    Replies:
    2
    Views:
    266
    Tom Gosselin
    Aug 10, 2004
Loading...

Share This Page