We have a .NET web application installed on our server at the location: C:\Inetpub\fmtool\
One of our utilities uploads a file to a subfolder of the installed directory.
We create the folder structure for this uploaded file programmically to ensure the folder structures integrity. This works just fine.
However during the actual file copy (using an asp file upload control) we get a permissions error saying access is denied.
I have ensured that the user-account running the application on the server has full control of the file system (in development of course) and we still get this access denied error.
FileUpload seems straight forward:
fuiUpload.SaveAs(path);
Were "path" is pulled from the Web.Config
<add key="ActualsImportPath" value="C:\Inetpub\fmtool\ActualsImport\Alpha"/>
If we were running this local we would need the full qualified server information in the beginning correct?
For example:
<add key="ActualsImportPath" value="\\SERVER-NAME\c$\blah"/>
UPDATE:
After inspecting my code. I found a glaring error. I did not actually have the full "path" variable set at the time I was attempting to process the SaveAs(). A simple mistake caused so much trouble. Thank you all for the help. See code below if interested
Before:
if (fuiUpload.HasFile)
{
// Did not have the complete path here.....
fuiUpload.SaveAs(path);
// Run the importer
switch (rblImportType.SelectedValue)
{
case "0":
path += @"\Nightly Costing\" + DateTime.Now.ToString("yyyyMMdd") + "-NightlyCosting.csv";
break;
After:
if (fuiUpload.HasFile)
{
// Run the importer
switch (rblImportType.SelectedValue)
{
case "0":
path += @"\Nightly Costing\" + DateTime.Now.ToString("yyyyMMdd") + "-NightlyCosting.csv";
fuiUpload.SaveAs(path);
break;