I'm using the RijndaelManaged class to encrypt data. One of the things I want to encrypt is a log file that records the usernames of the people who log on to my application.
When I write a single line to a file, I'm able to decrypt the data without a problem, but when I log onto the program again, thereby encrypting a second username to the file, I'm unable to successfully decrypt both lines of data. Only part of the second line is decrypted successfully. Does anyone have any suggestions/comments about why I'm encountering this problem?
How is it that you get a multi-line file from code that only writes one line?
Oops, just looked back and saw the APPEND option when you open the file. That's the problem.
You need to write the entire file each time if you plan on encrypting and decrypting it. It appears that you accidentally read some of it because you are using the same key and initialization vector each time.[/edit]
"You said a whole sentence with no words in it, and I understood you!" -- my wife as she cries about slowly becoming a geek.
The file is written to every time a user logs on to the application. I'm appending the new user information to the document each time the user logs on. So, the WriteLine is performed once each time through the application, but the file is appended the next time through.
private void View_Click(object sender, EventArgs e)
if (m_frmExport == null || m_frmExport.IsDisposed)
m_frmExport = new Export();
//If the m_frmExport is not yet closed/disposed, this will set the focus on this form.
How can i close an application using C#? I have tried using the Process.Kill method and it works pretty well, but does this method force the application to close or does it tell it to close. For example, i have noticed that many applications save a lot of thier settings while closing but when i use the Process.Kill method, they just seem to close forcefully. How do I go around this?
how can i write data/information from the database server to a file stored in the client PCs of my network. can i do it at the same time? if not its ok, as long as i can send all the data to all my client PCs.
the data is not that big, about 20-30 lines of text.(3-5 words per line) it just contains a list of information to be used by my Client side program... tnx..
I would like to use a progress bar in my application. What i am looking for is a wakeup bar that goes from 0 to 100 and back to 0 again. I would like run it when the process is running so that user know that process is running. Appreciate any feedback.