如何在服务器计算机上创建文件夹并复制文件?

问题描述:

如何在服务器计算机上创建文件夹并复制文件?我想在服务器计算机上创建一个文件夹.我为此有了一个新用户,并使用了密码.如何以编程方式创建文件夹并将文件复制到该文件夹​​.我已经尝试过



How to create a folder and copy a file in server machine? I would like to create a folder in a server machine. I got a new user for this with password. How to create a folder programmatically and copy a file to it. I have tried with



Directory.CreateDirectory(path)



我正在从Outlook获取附件文档,并将其保存到网络驱动器.将其保存在本地驱动器中时,它可以正常工作.但是将其保存在网络驱动器中时失败.另外,我还创建了一个新用户帐户,该帐户具有对网络路径的完整权限.


但是它说:System.IO.IOException:登录失败:用户名未知或密码错误.在System.IO.Directory.InternalCreateDirectory(String fullPath,String path,DirectorySecurity dirSecurity)处System.IO .__ Error.WinIOError(Int32 errorCode,字符串mayFullPath)



I am getting the attached documents from outlook and saving it to network drive. It works fine when it is saved in local drive. But it fails when saving it in network drive. Also I have a new user account created with full rights to the network path.


But it says : System.IO.IOException: Logon failure: unknown user name or bad password. at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath) at System.IO.Directory.InternalCreateDirectory(String fullPath, String path, DirectorySecurity dirSecurity)

您的用户必须有权访问目标计算机,并且必须首先通过身份验证,然后才能运行上述代码.

阅读以下内容:
http://*.com/questions/4154431/authenticating-user- to-create-directory-in-c-sharp [ ^ ]
Your User must have access to the target machine and must be authenticated first before running the above code.

Read the following :
http://*.com/questions/4154431/authenticating-user-to-create-directory-in-c-sharp[^]