3 Replies Latest reply: Oct 18, 2013 11:54 AM by Jamo RSS

    Systematically killing ASP.NET's red-headed stepchild, the aspnet_client folder.

    Aegis Kleais Community Member

      For those of you who don't know the "pleasure", upon installing .NET on your server (we had to, a 3rd party app we need uses it), Microsoft sees fit to propagate a "aspnet_client" folder into the root of every site on IIS as well as randomly through each site's subdirectories.  Truly, if I find the person responsible for this imbecile-ry, the b*tch-slapping will be pride obliterating.

       

      But that aside, I have created a scheduled task to find all instances of this folder for a directory and below (the web root) and to remove it.  Well, the problem is that doing a <cfdirectory> listing, even when just specifying "dir" for type and "aspnet_client" for the filter, ColdFusion takes over 30 seconds and times out before it can get a complete listing of where these folders exist.

       

      Can anyone think of an alternate way to get a listing of these folder locations?  Maybe directly through Java for a faster reading?  I run this script every hour on the hour, and it's just been timing out and never running (and the 'aspnet_client' folders have come back.)  I know this is a band-aid solution, but scouring the net for solutions on how to keep .NET from creating these abominations throughout a server has yielded nothing.

       

      At least CF has the decency to just create a 'CFIDE' and 'jakarta' vdir in the root of the sites you connect CF to.  THAT shows smart programming.  Microsoft on the other hand..... the other.... b*tch slappin hand....

        • 1. Re: Systematically killing ASP.NET's red-headed stepchild, the aspnet_client folder.
          Jamo Community Member

          I created a .bat file in the root directory to identitify and remove all "aspnet_client" subdirectories.  (These sub-directories appear to be created whenever there is a Windows update... so you shouldn't have to run it hourly.)

           

          c:\remove_aspnet_client.bat

          FOR /F "tokens=*" %%G IN ('DIR /B /AD /S *aspnet_client*') DO RMDIR /S /Q "%%G"

          • 2. Re: Systematically killing ASP.NET's red-headed stepchild, the aspnet_client folder.
            Aegis Kleais Community Member

            Love it, Jamo.  Sad that people have to resort to such a tactic simply because Microsoft is so myopic with this folder proliferation.

             

            I'm not as versed in batch scripts, but is there a way you could add an array/list of absolute URLs which are "whitelisted" from being removed (for the 3rd party apps we have that use .NET and may require the folder)

            • 3. Re: Systematically killing ASP.NET's red-headed stepchild, the aspnet_client folder.
              Jamo Community Member

              I'm also not that well versed with writing loops and exception filters using the command line.

               

              Maybe another option would be to occassionally + manually create a BAT file with a RMDIR command for each project to clean and leave out all non-.NET webroots.  (The sub-directory isn't not added automatically... so you would only have to run it after an update.)

               

              I use a Windows file manager called Total Commander (32/64 bit, Windows, free, awesome IMHO). It has a "Find Files" feature that allows the results to be fed back to the listbox. After the "aspnet_client" sub-directories are in the listbox, I use a command to "Copy Names with Path to Clipboard".  I copy them to a BAT file and add the RMDIR command in front of each directory listing.  (For help on RMDIR syntax, go to DOS and enter RMDIR /?)   You can also use CFDirectory's delete with the "recurse" option, but I prefer not impact or be dependent on ColdFusion if I can help it.  (We also tend to use nnCron instead of CFSchedule.)

               

              Total Commander   http://www.ghisler.com/

              nnCron   http://www.nncron.ru/