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

Posted on 2008-11-07
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.
    LVL 6

    Accepted Solution

    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

    thanks a lot.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    Extention Methods in C# 3.0 by Ivo Stoykov C# 3.0 offers extension methods. They allow extending existing classes without changing the class's source code or relying on inheritance. These are static methods invoked as instance method. This…
    This article is for Object-Oriented Programming (OOP) beginners. An Interface contains declarations of events, indexers, methods and/or properties. Any class which implements the Interface should provide the concrete implementation for each Inter…
    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 video discusses moving either the default database or any database to a new volume.

    761 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

    12 Experts available now in Live!

    Get 1:1 Help Now