W
Will
I'm having problems with the following code:
public static void saveEncryptedSession(DataSet ds, string pathToSave)
{
const string encryptionKey = "base64-string-snipped";
byte[] myKey = Convert.FromBase64String(encryptionKey);
XmlTextWriter w = new XmlTextWriter(pathToSave, Encoding.UTF8);
RijndaelManaged RMCrypto = new RijndaelManaged();
CryptoStream cs = new CryptoStream(w.BaseStream,RMCrypto.CreateEncryptor(myKey, myKey), CryptoStreamMode.Write);
ds.WriteXml(cs);
cs.Close();
w.Close(); -- errors out here: System.ObjectDisposedException Occured in
mscorlib.dll
}
Additional Information: Cannot Access a Closed File
Wondering if anyone has any insight on this? To give a little context I'm
basing my code off:
http://www.dotnet247.com/247reference/msgs/20/100432.aspx
Any Help would be appreciated, Thanks.
public static void saveEncryptedSession(DataSet ds, string pathToSave)
{
const string encryptionKey = "base64-string-snipped";
byte[] myKey = Convert.FromBase64String(encryptionKey);
XmlTextWriter w = new XmlTextWriter(pathToSave, Encoding.UTF8);
RijndaelManaged RMCrypto = new RijndaelManaged();
CryptoStream cs = new CryptoStream(w.BaseStream,RMCrypto.CreateEncryptor(myKey, myKey), CryptoStreamMode.Write);
ds.WriteXml(cs);
cs.Close();
w.Close(); -- errors out here: System.ObjectDisposedException Occured in
mscorlib.dll
}
Additional Information: Cannot Access a Closed File
Wondering if anyone has any insight on this? To give a little context I'm
basing my code off:
http://www.dotnet247.com/247reference/msgs/20/100432.aspx
Any Help would be appreciated, Thanks.