Permissions don't appear to be the issue here. Since I posted the original message, I noticed something quite important to the potential solution. When that method is executed by itself, the encryption process works as designed. When the previous method is executed, that's when the encryption does not happen. This method works because the datestamp on the file changes when it's called.
private void DownloadFile()
{
string sSaveAddress = System.Web.HttpContext.Current.Server.MapPath("/wsCN") + "/data/File1.ee";
System.Net.WebClient client = new System.Net.WebClient();
client.Credentials = new System.Net.NetworkCredential(sUserId, sPwd);
System.IO.Stream MyStream = client.OpenRead(sFolder);
System.IO.BinaryReader MyStreamReader = new System.IO.BinaryReader(MyStream);
System.Net.WebClient ftpClient = new System.Net.WebClient();
System.IO.Stream MyWriteStream = ftpClient.OpenWrite(sSaveAddress, "PUT");
System.IO.BinaryWriter MyStreamWriter = new System.IO.BinaryWriter(MyWriteStream);
int rd = 0;
long total = 0;
int bufSize = 1024;
byte[] buf = new byte[bufSize];
while ((rd = MyStreamReader.Read(buf, 0, bufSize)) != 0)
{
total += rd;
MyStreamWriter.Write(buf, 0, rd);
}
MyStream.Close();
Encrypt();
}
|