OpenStream() yeilds a stream that cannot be closed after writing

  •  04-18-2008, 6:08 AM

    OpenStream() yeilds a stream that cannot be closed after writing

    The following  code creates a hold on the temporary file on disk, even though I close the stream. The only way to continue to use the component is to shut down the aspnet_wp.exe to free the hold on the temporary file.

    protected
    void Uploader1_FileUploaded(object sender, CuteWebUI.UploaderEventArgs args)

    { byte[] imageBits = new byte[args.FileSize];

    Stream ms = args.OpenStream();

    // removing this statement makes the problem go away
    ms.Write(imageBits, 0, imageBits.Length);
     
    ms.Close();

    }
     
     
View Complete Thread