views:

143

answers:

3

Hello, Where i can save string , and when program run, user can change it -overrride. (not config file, i do not want that anybody can see what written).

Many thanks.

A: 

You can encrypt string before saving to configuration to prevent user to read that string.

ArsenMkrt
thanks , it is solution, but is it not possible save it in the EXE file?
Armen Khachatryan
You can try to store in dll using reflection emit, I don't think you can change exe that is executing... Isolated Storage is a way to store such data too, but it is not so secure too, so you should encrypt in this case too.
ArsenMkrt
+1  A: 

Since you are using Windows Application, your best bet is isolated storage.

[Old Answer]
In case you are using a web application:
If you want to do save the string till the user is logged in then you can store it in the Session state, if you want to store it for the lifetime of the web application in IIS then you can use Application State

Of course you can store the same in a database if required.

Binoj Antony
sory , desktop app
Armen Khachatryan
+1  A: 

You can use the Settings (in Project Properties) to store USER and APPLICATION specific values. USER values can be changed and saved by the user at runtime and are stored in user's appdata directory (user.config) on the system whereas the APPLICATION values are stored in OUTPUTFILE.CONFIG file in the application directory.

You can encrypt these USER values before saving and decrypt after loading them. The values can accessed as: Properties.Settings.Default.SETTINGNAME

Also, if you want to do the reading and writing yourself, you can check the EncryptedXml class.

A9S6
Tahnks you! and is it not possible to save read date in EXE file yes ?
Armen Khachatryan
I don't think it is possible to update the EXE file itself. Office files such as DOC, XLS etc can keep Custom Properties using DSOFILE library but for EXEs I am not aware of any such utility
A9S6