Click here to Skip to main content
15,892,537 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:
I am reading and writing some configuration files in the Program Files i.e installed directory.

unfortunately whenever i write or read it is taking from Virtual store in Virtual store

C:\users\user-a\AppData\Local\VirtualStore\Program Files (x86)

i am using windows 7 64bit system. Because of this my application is giving wrong results.

how do i resolve this.
Posted
Comments
Sandeep Mewara 29-May-12 7:45am    
Related code snippet ?

Write your configuration files to a place where they belong to!
It is either the ApplicationData folder of the user the the ProgramData folder. You get them with Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) or CommonApplicationData.
By the way, do not write your files directly into those folders. Instead, create a folder with your company name, and there a folder with the program name, and there come your configuration files.
 
Share this answer
 
That's because the Program Files folder is readonly to normal users. Your code should not be writing anything to any place under Program Files at all.

Like Bernard has said, put your data in a more appropriate place. If you don't know what that should be, read up on this list[^].
 
Share this answer
 
 
Share this answer
 
Comments
Anoop Ananthan 29-May-12 7:58am    
The link does not provide a solution to the problem!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900