Solved

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

Posted on 2010-11-09
6
563 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
  • 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
3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

 
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

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Get id from json Data with NewtonSoft 3 33
Anyway to make "All" the default in the dropdown? 6 34
Data is not showing from images 15 37
Server Error 11 47
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 …
Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
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.

911 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now