Click here to Skip to main content
15,892,674 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi
I created a project on wpf windows using c#

when i am trying to store and retrieve the txt files on the system it is working fine , i made a installer through innosetup. i cant able to store and retrieve the data on the system through exe file but it is working fine on visual studio environment can any body tell me how should we create txtfile on the system through exe file .

thanking you in advance
uday
Posted

1 solution

The chances are that when you were working in development, your code looked something like:
C#
File.WriteAllText("MyTextFile.txt", "This is a line of text");
...
string data = File.ReadAllText("MyTextFile.txt");
which works fine - but it stores the file in the application folder which is readable and writable on your development machine, but when you try to do it in production, the application is stored under the "Program Files" folder which is not normally accessible to prevent viruses and worms fro tampering.

Instead, have a look here: Where should I store my data?[^] which explains safe places you can store data.
 
Share this answer
 

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