Vijay Agrawal
Vijay Agrawal

Reputation: 21

Not able to delete a file because of IIS

What is the functionality

This web application allows user to upload to web-server, download and delete files uploaded on web-server.

Problem

After downloading a file, when user tries to delete it, an exception is thrown saying this file is being used by another process.

What can be done after download is complete so that IIS releases any lock on the file?

Upvotes: 1

Views: 737

Answers (1)

Shane Neuville
Shane Neuville

Reputation: 2177

Are you using Server.TransferFile to serve the file from the server? Or you might have something setup in your handlers that causes a similar method to send the files.. The only thing I've seen to unlock the file is to reset IIS :-/

Instead of letting IIS serve the file if you let asp.net send it back in the Response stream then you shouldn't get a problem with the file being locked

also make sure you're disposing of any STream readers that are accessing the files..

If that doesn't help then please post code :-)

Upvotes: 1

Related Questions