By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,635 Members | 2,227 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,635 IT Pros & Developers. It's quick & easy.

store user DATA

P: n/a
hi
I am new to C# programming. can anyone tell me what is the standard way to
store high sensitive user data for application, so that application next run
can get back those data.

Nov 15 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
Well that all depends on the tools available to you.

You could store the data in a database (SQL server, Access etc...) you
could store the data in a proprietary binary format. Databases are good for
persistent data storage and usually have pretty good security and
encryption.

-Casey
--
Legal Disclaimer: just in case you were wondering:
This posting is provided "AS IS" with no warranties, and confers no rights.

"pei_world" <pe*******@hotmail.com> wrote in message
news:OW**************@TK2MSFTNGP12.phx.gbl...
hi
I am new to C# programming. can anyone tell me what is the standard way to store high sensitive user data for application, so that application next run can get back those data.

Nov 15 '05 #2

P: n/a
You have a bunch of different ways.

1. StreamReader and StreamWriter classes, allow you to read files.

// create or open a file
StreamWriter writer = new StreamWriter("c:\\test.txt");
// write data to it
writer.WriteLine("File created using StreamWriter class.");
// close
writer.Close();

similar class called StreamReader reads the file.

Also you could create a class which derives from a persistent class,
which then allows you to write that classes properties to disk.

[Serializable]
public class Dog {
public string name;
public string licenseTag;
}

Dog d = new Doc ();
d.name = "Rex";
d.tag = "OU812";

IFormatter formatter = new BinaryFormatter();
Stream stm = new FileStream("myDataStore.dta",
FileMode.Create, FileAccess.Write,
FileShare.None);
formatter.Serialize (stm,d); // stream the dog object out to disk.
stm.Close();

To read it back:
;IFormatter fmt = new BinaryFormatter();
Stream stm = new FileStream("myDataStore.dta",
FileMode.Open, FileAccess.Read,
FileShare.Read);
Dog dogFromDisk = (Dog) fmt.Deserialize(stm);
stm.Close();

// the data has now been restored in the object
//
this will store the data in binary. If you need moer security then you could
(just a wacky thought)
after you write the object to disk, then encrypt it. When you load the
object back into memory, then
decrypt the file before loading the stream.

With the file writina approach you could also encrypt it before you write it
to file
and then when you read the data back in, then once you have read it, then
decrypt it maybe?

of course, there are things like xml disconnected datasets and databases and
all that, but my
impression was you wanted to store some simple data say password or
something like that in a file, which
is in the same directory as the application or something like that. With
that assumption, i think
these approaches should get you up and running pretty quickly without the
need for you
to learn any of those other technologies.... but as I said it depends on
your needs.

hope that helps,
J

hope thi

"pei_world" <pe*******@hotmail.com> wrote in message
news:OW**************@TK2MSFTNGP12.phx.gbl...
hi
I am new to C# programming. can anyone tell me what is the standard way to store high sensitive user data for application, so that application next run can get back those data.

Nov 15 '05 #3

P: n/a
You have a bunch of different ways.

1. StreamReader and StreamWriter classes, allow you to read files.

// create or open a file
StreamWriter writer = new StreamWriter("c:\\test.txt");
// write data to it
writer.WriteLine("File created using StreamWriter class.");
// close
writer.Close();

similar class called StreamReader reads the file.

Also you could create a class which derives from a persistent class,
which then allows you to write that classes properties to disk.

[Serializable]
public class Dog {
public string name;
public string licenseTag;
}

Dog d = new Doc ();
d.name = "Rex";
d.tag = "OU812";

IFormatter formatter = new BinaryFormatter();
Stream stm = new FileStream("myDataStore.dta",
FileMode.Create, FileAccess.Write,
FileShare.None);
formatter.Serialize (stm,d); // stream the dog object out to disk.
stm.Close();

To read it back:
;IFormatter fmt = new BinaryFormatter();
Stream stm = new FileStream("myDataStore.dta",
FileMode.Open, FileAccess.Read,
FileShare.Read);
Dog dogFromDisk = (Dog) fmt.Deserialize(stm);
stm.Close();

// the data has now been restored in the object
//
this will store the data in binary. If you need moer security then you could
(just a wacky thought)
after you write the object to disk, then encrypt it. When you load the
object back into memory, then
decrypt the file before loading the stream.

With the file writina approach you could also encrypt it before you write it
to file
and then when you read the data back in, then once you have read it, then
decrypt it maybe?

of course, there are things like xml disconnected datasets and databases and
all that, but my
impression was you wanted to store some simple data say password or
something like that in a file, which
is in the same directory as the application or something like that. With
that assumption, i think
these approaches should get you up and running pretty quickly without the
need for you
to learn any of those other technologies.... but as I said it depends on
your needs.

hope that helps,
J

hope thi

"pei_world" <pe*******@hotmail.com> wrote in message
news:OW**************@TK2MSFTNGP12.phx.gbl...
hi
I am new to C# programming. can anyone tell me what is the standard way to store high sensitive user data for application, so that application next run can get back those data.

Nov 15 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.