Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 651
  • Last Modified:

ASP.NET Web app access to c:\inetpub\ftproot

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);
fs.Close();
0
cestes001
Asked:
cestes001
1 Solution
 
becraigCommented:
I have found in the past that sometimes the permissions on C:\WINDOWS\TEMP or whichever the temp folder is for your app tends to be the problem.

I would suggest you run your app with impersonation ( a local account of some sort and grant full access to temp). Anything else would not be as secure.

I think it is a temp folder access that is your issue though.
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now