Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7009007
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T21:48:29+00:00 2026-05-27T21:48:29+00:00

My VB.NET application has a very important boolean variable. I need to be able

  • 0

My VB.NET application has a very important boolean variable. I need to be able to save it “somewhere” and read it back in the future (even if the application is closed).

Currently, I store the variable as a .bin file somewhere. But I fear that the user can simply grab the file and do some magic to edit the value.

I need to make this value completely unavailable from the user’s eyes. Or at least, make it impossible to edit. What is the best way to hide such value?

I managed to store the variable in my online MySQL database. But honestly, that doesn’t work very well for my purposes. I need to store it locally…

Any ideas?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T21:48:30+00:00Added an answer on May 27, 2026 at 9:48 pm

    Theoretically, you can never hide this variable at all. However, you can make it harder to find or read. To know how to hide the variable, you must first know some common ways of retrieving it.

    Typical problems and solutions

    How others could theoretically retrieve your variable value

    1. Decompiling your program with a single click using .NET Reflector or any other .NET Decompilation program.
    2. Analyze the memory of the PC while the program is running, and retrieve the value from there.
    3. If your value was saved in a file, the user could easily find it by analyzing harddrive IO activity through a hook or a dump comparison.
    4. If your value was saved in the registry, a simple registry hook or registry dump comparison tool could figure out where the value is stored.
    5. If your value is encrypted, method #1 (decompiling the program) could be used to figuring out how a decryption could be done.

    Solving the possible issues above

    1. A general obfuscation program can be used to make it harder to decompile applications. For this, I suggest SmartAssembly. Other than that, there’s a tool called Spoon Studio (previously called PostBuild) which will recompile your application into assembly code (and also make it run without the .NET Framework installed).
    2. The SecureString class could be used to make it harder to find and decrypt the value while it’s in the memory. This class also cleans itself up after usage, but is generally slightly slower to use than a normal string.
    3. Storing things in a file is not nescessarily a bad idea (even if people can sniff file activity), since you can always store the variable in a non-pretty way. For instance, you could have a file called IsFullScreen.bin, that contained the value of your boolean variable (1 or 0, or true or false), even though it has nothing to do with full-screen rendering. This would make it a bit confusing, but also not very pretty programming-wise.
    4. For the registry, everything in solution #3 still applies.
    5. Encryption is not a bad idea either, and it is hard to decrypt some encryption types (for instance public/private key encryption if you have a server), or hashing (such as MD5 or SHA1).
    6. In your scenario, could you store the value on a server instead?

    So to summarize …

    You can’t protect your application entirely. But you can use some of the solutions above (or combine them) for a better protection making it harder.

    Of course, premature security is bad. If that boolean isn’t VERY important, then some simple encryption would be fine too in my opinion.

    There’s more …

    Edit 1

    I just noticed that you’ve commented on your own answer saying that the file should not be “valid” after copying it to another computer and reading it from there.

    If that’s the case, you could use some key-based encryption such as XOR encryption, and then use the MAC-address of the PC or the motherboard serial number as key for that encryption.

    Being on the computer that the file was created on would then be needed to read the file as well. If you’re interested in this, add a comment and I’ll give you a code example.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a console application which has target .NET 2.0 It is very short
I am building a web application using ASP.NET MVC that has two very distinct
In an ASP.NET MVC application (which has very little chance of having its view
My C# (.NET 2.0) application has a StringBuilder variable with a capacity of 2.5MB.
I'm working in mid-size .NET application which has a very very bad if not
I was in a ASP.NET application has heavy traffic of AJAX requests. Once a
We have a VB.Net application that has in the region of about 80 unique
How can I determine all of the assemblies that my .NET desktop application has
I have a TreeView control in my WinForms .NET application that has multiple levels
I have a asp.net web application which has a number of versions deployed on

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.