I am copying a 500MB file in asp.net. Whenever user closes web application in the middle of the copy, the next time i try to copy it again it is throwing me an error "Access to the path is denied". I want to close that process whenever user leaves the webpage in the middle of the copy. One possible way could be closing that process in the Session_End event of the global.asx page. But i dont know how to implement it. Any idea would be greatly appreciated.
File.Copy(SrcPath,DestPath,true);