ASP.NET MVC3 Copy file to Shared Mapped Drive - Access to the path is denied

情到浓时终转凉″ 提交于 2019-12-24 01:45:05

问题


Currently I am getting this error when trying to copy a local file over to a shared network drive.
Access to the path '\\vlanxxxx\Vlanxxx\VT\12345.pdf' is denied'

Background Information

  • Running ASP.NET MVC3, Windows Server 2008 R2
  • In IIS->Application Pools my Application has the correct permission to access the shared drive
  • I have tried copying the file from a local folder to local folder and it worked successfully.
    i.e C:\log\12345.pdf -> C:\test\12345.pdf



Purpose: My overall purpose is to copy a file in my local server to a shared mapped network drive.

Q: Is this actually possible when using ASP.NET, is there any networked shared drive limitations when using this technology?

Code for copying the file over (I am pretty sure the code is fine, but here is the code incase)

String path = @"C:\log\12345.pdf";
String dest_path = @"\\vlanxxxx\Vlanxxx\VT\12345.pdf";
File.Copy(path, Path.Combine(dest_path, Path.GetFileName(path)));

Thank you for the help and assistance, I appreciate your time! Please let me know if there is any misunderstanding in the question. I will try to edit and clarify as soon as possible.


回答1:


In IIS, try to give write permission to the users IUSR and IIS_IUSR in that destination path / folder.



来源:https://stackoverflow.com/questions/16224084/asp-net-mvc3-copy-file-to-shared-mapped-drive-access-to-the-path-is-denied

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!