简体   繁体   中英

upload file to the network mapped drive in c#

I am using c# asp.net mvc 3 and entity framework to upload the file to the network drive mapped as Z drive. I have following c# code for determining file path:

var path = Path.Combine(Z:/upload/catone/", fileName);
aries.SaveAs(path);

I am using window server 2008 and IIS 7. I have also check Security of upload folder of network drive and have acess full control for EVERYONE user. If I changed file path to local drive, it works fine. But it shows following error while uploading to network drive (Z:/).

Could not find a part of the path 
'Z:\upload\catone\_2013011504265221N_todaily.wav'.

Your code is running under IIS and thus is run with access privileges of the IIS user account which may not have access to that network drive.

You can try runnning the app pool under your identity for instance, to rule this issue out, or give full access to the group IIS_IUSRS to that folder.

First of all save the file in local machine , than after use file.copy(Source, Destination, true) method to save file in network drive.

try that it is helpful for you

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM