Non-native persistent storage

  • Thread starter Thread starter Ole Christensen
  • Start date Start date
O

Ole Christensen

Hi,

Anyone knows a way to store variables between running a program in the
Framework envirronment instead of using e.g. the registry database under
windows? Is it e.g. possible to store the variable values in the exe file
itself (it is after all just a text file)?

Any help is highly appreciated- thank you!

Ole
 
Hi,

What about a config file? of course not the app config file as it's readonly

why not the register?

cheers,
 
Ole,

The exe file actually is not a text file. Open it up in notepad, and
tell me what you see =) I think that what you meant to say was that it is
just bytes, like any other file.

Doing this sort of thing in .NET is impossible (AFAIK), and not
recommended if it was. The reason for this is that security is based on
evidence, and one of those pieces of evidence is a hash of the assembly. If
you were able to change the contents, and you had security policies that
were dependent on the hash, then your assembly would fail to be given the
appropriate permissions.

Why not just store the values in a file where the assembly is located?

Hope this helps.
 
Thank you both,
My guees is that in the near future we will see a lot of other devices /
OS'es that will support the .NET framework (like apple etc.), but it is only
windows that support the registry database.

Now where we finally got rid of the registry database during installation I
thought it would be very smart if we do totally without it - it would be so
nice just to move or copy the exe file from one machine (PC, Apple, PDA...)
to another without having to remember additional files and dlls. Well - I
will store the parameters in a support file for now.

Thank you for your help - it was great even thought it was a negativ answer
because I have saved a lot of time searching for a solution.

Ole

Nicholas Paldino said:
Ole,

The exe file actually is not a text file. Open it up in notepad, and
tell me what you see =) I think that what you meant to say was that it is
just bytes, like any other file.

Doing this sort of thing in .NET is impossible (AFAIK), and not
recommended if it was. The reason for this is that security is based on
evidence, and one of those pieces of evidence is a hash of the assembly. If
you were able to change the contents, and you had security policies that
were dependent on the hash, then your assembly would fail to be given the
appropriate permissions.

Why not just store the values in a file where the assembly is located?

Hope this helps.


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

Ole Christensen said:
Hi,

Anyone knows a way to store variables between running a program in the
Framework envirronment instead of using e.g. the registry database under
windows? Is it e.g. possible to store the variable values in the exe file
itself (it is after all just a text file)?

Any help is highly appreciated- thank you!

Ole
 
Back
Top