I have a strange problem, if I use this code the file is created, but when I execute the Download line, the download does not occur and the message “DISCONNECTED” appears and the App closes.
string cPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, AppDomain.CurrentDomain.RelativeSearchPath ?? “”) + “\\Temp\\”;
StreamWriter sw = new StreamWriter(cPath + “test.txt”);
sw.WriteLine(“1234567890”);
sw.Close();
Application.Download(cPath + “test.txt”);
But if I leave the created file and use ONLY Application.Download(cPath + “test.txt”); everything is fine, I don’t understand this behavior, maybe the StreamWriter is causing some problems?
Thank you
Try replacing AppDomain.CurrentDomain.BaseDirectory, AppDomain.CurrentDomain.RelativeSearchPath with Application.StartupPath, it’s probably an issue with the StreamWriter and the path.
Let me know if that works
Best,
Alaa
Please login first to submit.