locked
How to remove auto generated files in App_data/Temp folder RRS feed

  • Question

  • User1382762722 posted

    Hello,

    I am working on project where functionality of file uplaod has to be provided.

    Everything seems to be working fine except one thing : Files generated in App_data/Temp folder seem to remain.

    I have observed that files are generated because of the file upload functionality and those files never get deleted. As in my case, files uploaded are going to be of large size, it may block huge amount of memory in long run.

    Could anyone please tell me how I can remove those files ? or How to avoid generating those file at first place ?

    Thursday, January 3, 2013 12:54 AM

Answers

  • User-1716253493 posted

    try use session start or session end

            string tempfolder = Server.MapPath("~/App_data/") + @"\" + "temp";
            try
            {
                System.IO.Directory.Delete(tempfolder);
            }
    
    
    

    After delete it and recreate the folder

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, January 3, 2013 3:41 AM

All replies

  • User-1716253493 posted

    try use session start or session end

            string tempfolder = Server.MapPath("~/App_data/") + @"\" + "temp";
            try
            {
                System.IO.Directory.Delete(tempfolder);
            }
    
    
    

    After delete it and recreate the folder

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, January 3, 2013 3:41 AM
  • User1382762722 posted

    Apologies for such a late reply.

    Actually it was my mistake in the implementation which created the entries twice. But yes, I did what you had suggested to delete files.

    Thank you very much for the reply\answer.

    Monday, April 1, 2013 5:56 AM