Click here to Skip to main content
15,889,456 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
For the second portion, I had now added the code to read the hash from the textfile. But my concern is where should I saved these hash into so that it will be stored in the application.(Meaning: the application will be able to run without the textfile in the same directory).

Anyone assistance would be greatly appreciated(FYI: I am using visual studio)?
Posted
Comments
F-ES Sitecore 9-Dec-15 5:03am    
You'll need to store the data *somewhere*, it can't reside inside the application itself. Either a text file, a database, or maybe the registry. If you store your data in a file and the file isn't there your app can't work, that's no different from any other application.
Eilson Tang 9-Dec-15 20:51pm    
ok, you answered my question. Thanks
BillWoodruff 9-Dec-15 5:17am    
Please do not repost; instead edit the question you asked only 8 hours ago.

I wonder if we have an article on such an argument[^].
 
Share this answer
 
Comments
Eilson Tang 9-Dec-15 5:01am    
haha, not one of those. what I means was using c# coding to save it in the application
CPallini 9-Dec-15 5:12am    
Then, I suppose, you can go with 'resources':
https://msdn.microsoft.com/library/xbx3z216(v=vs.100).aspx
That is the wrong way to do it. You should save the hashed password in a file (app.config is one possibility). Then when someone runs the app they enter the password, the code converts it into a hash and compares with the saved value.
 
Share this answer
 
Comments
Eilson Tang 9-Dec-15 20:44pm    
Richard, your solution is kind of what I am thinking of, but when you say save the hashed password in app.config, is there any c# coding that I can make use of or I can only manually key in to app.config?
Richard MacCutchan 10-Dec-15 4:10am    
Take a look at the following articles http://www.codeproject.com/Articles/34459/How-You-Can-Change-the-applicationSettings-and-use and Secure Password Authentication Explained Simply. The first one is VB.NET but converting to C# should be fairly easy.
There can be different ways to save the data in the file. First of all, it's important to choose right location for the file. Please see my past answer: How to find my programs directory[^].

How to save and restore arbitrary data structure. This is the most robust and comprehensive approach, which is also the easiest to use: http://msdn.microsoft.com/en-us/library/ms733127.aspx[^].

See also my past answers:
how to pass a datacontract from a C#/WCF code to Managed C++[^],
How can I utilize XML File streamwriter and reader in my form application?[^],
Creating property files...[^].

—SA
 
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