Solved

C# Read\write access to the programs files directories in XP

Posted on 2010-11-09
6
569 Views
Last Modified: 2012-05-10
Hello Experts,

I have a self-repairing application that requires access to a folder under the program files directory.  Weebo (yeah, I named it after the maintenance droid in flubber...), checkes the App folder (c:\program files\bob\), deletes all of the template files, then copies current template files.

Any discussion of technique is moot for this particular application, but par for the course for future endeavors...  Anyways, I know it worked on most machines until recently.  The weird thing is that it works on a PC pacted up to SP3, but not on a system that was loaded with SP3 (and then Weebo is installed)

Can someone tell me how to get control of my directory back?  It is a big endevor to fix this otherwise.
0
Comment
Question by:the_b1ackfox
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
6 Comments
 
LVL 6

Expert Comment

by:r3nder
ID: 34099303
protected void CleanImageFolder()
{
    string imgFolder = Server.MapPath("~/lab/maskemail/img/");
    string[] imgList = Directory.GetFiles(imgFolder, "*.jpg");
    foreach (string img in imgList)
    {
        FileInfo imgInfo = new FileInfo(img);
        if (imgInfo.LastWriteTime < DateTime.Now.AddMinutes(-3))
        {
            imgInfo.Delete();
        }
    }
}
0
 
LVL 9

Author Comment

by:the_b1ackfox
ID: 34100540
I had originally asked this question as I was running out the door from work, and I have come to realize that my question isn't very well stated.  So I am going to try and restate it now.

My App (weebo) is crashing on some Windows XP systems while it is trying to delete files.  I initially thought that it wasn't deleting any files at all...   but upon further inspection, it seems as though some of the files are deleted indeed.

Since it works flawlessly on a few systems, I figured the problem was systemic (and it is, just not how I thought)  It is systemic in the fact that I stopped troubleshooting, because I thought the problem was with the OS updates.

I now think the answer lies in adding logging functionality, and trapping/debugging the errors...  :)
0
 
LVL 6

Accepted Solution

by:
r3nder earned 500 total points
ID: 34102444
use try catch statements and print the error to the screen - my first thought is that it is going to be "run as administrator" issues
0
Cloud Training Guides

FREE GUIDES: In-depth and hand-crafted Linux, AWS, OpenStack, DevOps, Azure, and Cloud training guides created by Linux Academy instructors and the community.

 
LVL 9

Author Comment

by:the_b1ackfox
ID: 34142116
still working on putting this into testing...  weird part, is I now have it running on a defferent computer...  
0
 
LVL 6

Expert Comment

by:r3nder
ID: 34142291
Odd, let me know all the symptoms so I can better understand whats going on and get you up and running :)
Thanks
R3nder
0
 
LVL 9

Author Comment

by:the_b1ackfox
ID: 34478130
R3nder... sorry about that, I didn't mean to not get back to you.  I am awarding you points and an apology!
0

Featured Post

MS Dynamics Made Instantly Simpler

Make Your Microsoft Dynamics Investment Count  & Drastically Decrease Training Time by Providing Intuitive Step-By-Step WalkThru Tutorials.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I don't know if many of you have made the great mistake of using the Cisco Thin Client model with the management software VXC. If you have then you are probably more then familiar with the incredibly clunky interface, the numerous work arounds, and …
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
This is used to tweak the memory usage for your computer, it is used for servers more so than workstations but just be careful editing registry settings as it may cause irreversible results. I hold no responsibility for anything you do to the regist…
Hi friends,  in this video  I'll show you how new windows 10 user can learn the using of windows 10. Thank you.

622 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question