Deleting a text file on web server.

mike55

Contributor
Joined
Mar 26, 2004
Messages
727
Location
Ireland
Hi,

Am trying to delete a file on the web server. This particular file has been downloaded from the server to my local machine. I had been using the command:
Code:
File.Delete("C:\Temp\test.txt")
But this does not seem to be deleting the file.

Any suggestions??

Mike55
 
Thanks for the reply PlausiblyDamp,

I found the solution to my problem. Here's what I was doing:
1. Retrieve all my data from the database and write it to a .CSV file.
2. Offer the user the choice of either Saving, Opening or Cancel the .CSV file.
3. Whatever option the user selected, I would then delete the .CSV file from my web server.

The problem is that when the "Save, Open, Cancel" dialog appeared, no other code would run after that.

So here is what I did,
1. Use a file stream to read the data from the .CSV file.
2. Delete the file on the web server.
3. Write the data in the file stream to the users location if they choose the Save or Open option.

Mike55.
 
Back
Top