I am opening a file in my .aspx page like so:
// Pass the file path and the file name to the StreamWriter constructor.
objStreamWriter = new StreamWriter(Server.MapPath("Employee.txt"));
If I should kill the page and restart the page I get the following message:
The process cannot access the file
"c:\inetpub\wwwroot\integration\Employee.txt" because it is being used by
another process.
If I wait long enough (about 30 seconds), I can run the page without the
error.
I assume this is because even though the page has died, the Post Back is
still running, but if the Post Back should die for some reason and the file
does not get closed, it will stay in use. Is there a way to override the
"in use" status and delete the file without stopping and restarting the web
server?
Thanks,
Tom