I have an app that writes a text file (currently to the App_data folder of the app, itself. I would like to write the text file to the FTP folder, because we have a monitor app on the server that forwards all the files that land in that folder to another ftp server.
When I try to write the file from my app, I get
Access to the path 'c:\inetpub\ftproot\test.txt' is denied'
I've given Network Service account read/write permissions on the folder, c:\inetpub\ftproot, but I can't get past that error.
Here is the code that writes the file:
filename = "c:\\inetpub\\ftproot\\" + Session["OrdRefNo"] + ".txt";
FileStream fs = File.Create(filename, 1024);
Byte info = new System.Text.UTF8Encoding(true).GetBytes(strHeader + strParams + "5,1,1");
fs.Write(info, 0, info.Length);