How do I edit read only .ini file on the system root from the code on windows vista ?

Posted on 2008-11-07
Medium Priority
Last Modified: 2012-05-05
I have a windows application compiled on c#.It works on Windows XP but if I install it on Windows Vista it gives me error. The Application has one ".ini" file which saves some configuration settings into it. And this file is created at the application folder after running the application.Application foldre is on system root\Program files. When I run the application on windows vista and I create that ".ini" file,Windows Vista put  it as Read Only. Because of this ,if I can't edit that file from the application runtime , it gives me message as "access to the file denied". It happens only on Windows vista.

Accepted Solution

den4b earned 750 total points
ID: 22905147
Vista UAC blocks you from accessing files in "program files" folder.

You can do one of these 3 things:
1) acquire/elevate user permissions within your software,
2) store your settings in application-friendly CSIDL_APPDATA folder,
3) turn off UAC from the control panel (not a good idea).

Author Closing Comment

ID: 31514379
thanks a lot.

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

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

Summary: Persistence is the capability of an application to store the state of objects and recover it when necessary. This article compares the two common types of serialization in aspects of data access, readability, and runtime cost. A ready-to…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
The Task Scheduler is a powerful tool that is built into Windows. It allows you to schedule tasks (actions) on a recurring basis, such as hourly, daily, weekly, monthly, at log on, at startup, on idle, etc. This video Micro Tutorial is a brief intro…
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …
Suggested Courses

807 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