Solved

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

Posted on 2014-02-08
1
639 Views
Last Modified: 2014-03-02
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
Comment
Question by:cestes001
1 Comment
 
LVL 29

Accepted Solution

by:
becraig earned 500 total points
ID: 39844725
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

NAS Cloud Backup Strategies

This article explains backup scenarios when using network storage. We review the so-called “3-2-1 strategy” and summarize the methods you can use to send NAS data to the cloud

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

If you don't have the right permissions set for your WordPress location in IIS, you won't be able to perform automatic updates. Here's how to fix the problem.
When it comes to showing a 404 error page to your visitors, you do not want that generic page to show, and you especially do not want your hosting provider’s ad error page to show either. In this article, I will show you how to enable the custom 40…
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …

776 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question