Delete folder when session time-out..

Last post 12-28-2007 7:57 AM by hardik dave. 17 replies.

Sort Posts:

  • Re: Delete folder when session time-out..

    10-30-2007, 4:23 AM
    • Member
      342 point Member
    • bass4g0d
    • Member since 10-22-2007, 10:53 PM
    • Portugal
    • Posts 72

    gunteman:

    Just copy the code from the workaround:

     

    PropertyInfo p = typeof(System.Web.HttpRuntime).GetProperty("FileChangesMonitor", BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Static);
    object o = p.GetValue(null, null);
    FieldInfo f = o.GetType().GetField("_dirMonSubdirs", BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.IgnoreCase);
    object monitor = f.GetValue(o);
    MethodInfo m = monitor.GetType().GetMethod("StopMonitoring", BindingFlags.Instance | BindingFlags.NonPublic);
            m.Invoke(monitor, new object[] { }); 

      ..and add it to a good place, such as Application_Start in global.asax

    You must add "using System.Reflection" to Global.asax.cs 


    This don't work on one of my application pools that i use for ASP.NET 2.0 apps. Using an App Pool that i have with 1.1 and 2.0 websites works fine. This is not recommend by the H-Phere guys.

    Every new apps i try to publish now have this issue in all app pools. Any ideas?

    Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.
  • Re: Delete folder when session time-out..

    12-28-2007, 12:53 AM
    • Member
      8 point Member
    • hardik dave
    • Member since 10-04-2007, 5:00 AM
    • Posts 16

    Hi,

    I tried the workaround given by you, but still the folder is still there for sometimes and then it vanishes.

    My scenario is, i create folder(s) inside C:\Inetpub\wwwRoot\ [app folder]\webapp\xyz\projects\abc\ [here i create a folder]. I also add files to this folder and then try to delete this folder by traversing from bottom to top by deleting first the files in the folder and then if folder is empty. then i try to delete this folder. At the time of deletion, i dont get any error, but when i again come back to same folder, my application tries to reload all the subfolders beneath the specific folder and i receive error "Access to path [full path with folder name] is denied". I had placed the above code given by you in Application_Start(). After sometime the folder automatically gets deleted. I have give full rights to Network Service (as mac is Win2k3), i have full rights on the machine. I have given all the rights to the app folder in C:\Inetpub\wwwRoot\ [app folder]. Apart from placing the code given by you, still i am facing the same problem. Can you please help me if you can. I need to complete my work and deliver as soon as possible.

    Thanks

    Hardik Dave

  • Re: Delete folder when session time-out..

    12-28-2007, 7:57 AM
    • Member
      8 point Member
    • hardik dave
    • Member since 10-04-2007, 5:00 AM
    • Posts 16

    Hi,

    I too had the same problem. Actually, in my case, i need to create the folder(s) in the path as - C:\inetpub\wwwroot\ [web app folder]\WebApp\ [create folder here]. Now i was to copy files (.jpg, .bmp. .gif....) in to this folders and according to the functionality remove them from these folders. According to the solution provided above, i tried it but didn't work out. I had a work around for that. I created a folder in a same drive with another name and then move the folder which is to be deleted to that particular folder. This work out for me and application also didnt gave me any error.

    If anyone need code for the workout which i had done, do reply to this mail, i will be happy to help you guys.

    ----------------------------------------------------------------------------------------------------

    If you find this reply suitable for your query, do click "Answer".

    Thanks

    Hardik

     

Page 2 of 2 (18 items) < Previous 1 2