将文件夹从一个PC复制到服务器 [英] copy folder from one Pc to Server

查看:64
本文介绍了将文件夹从一个PC复制到服务器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





实际上我正在处理将我的电脑上的文件夹复制到(另一台服务器)(在网络上)的应用程序,因为我必须手动通过传递登录凭据访问该PC。有没有办法通过传递网络凭证在c#(v 2.0)中编写代码,当我运行它时应该是自动访问并复制该服务器上的文件夹。



亲切建议。

解决方案

您可以在服务器上创建共享文件夹,并将读写权限应用于您的Windows帐户。



http://www.techrepublic.com/blog/window-on-windows/how-do-i-share-folders-in-windows- 7-with-the-shared-folder-wizard / 3180 [ ^ ]



编辑 - 2月3日13日

在另一台机器上创建共享文件夹后。您可以使用C#File类从应用程序中复制files \文件夹。

http://social.msdn.microsoft.com/forums/en-US/csharpgeneral/thread/faf174a4-dbd6-4aab-a8dc-6d52a8b2ac3b [< a href =http://social.msdn.microsoft.com/forums/en-US/csharpgeneral/thread/faf174a4-dbd6-4aab-a8dc-6d52a8b2ac3b\"target =_ blanktitle =New Window> ^ ]


您可以为此使用模拟。您可以在配置文件中定义它,也可以在代码中添加任意内容。



http://stackoverflow.com/questions/125341/how-do-you-do-impersonation-in-net [<一个href =http://stackoverflow.com/questions/125341/how-do-you-do-impersonation-in-nettarget =_ blanktitle =New Window> ^ ]

Hi,

Actually i m working on application which copy a folder from my pc to (another server)(both on network), for that i have to manually access that pc by passsing login credentials. is there any way to write code in c# (v 2.0) by passing network credential and when i run it should be auto access and copy folders on that server.

kindly suggest.

解决方案

You can create a shared folder on the server and apply the read-write permissions to your windows account.

http://www.techrepublic.com/blog/window-on-windows/how-do-i-share-folders-in-windows-7-with-the-shared-folder-wizard/3180[^]

Edit - 4 Feb-13
Once you create shared folder on another machine. You can using C# File classes to copy the files\folders from the application.
http://social.msdn.microsoft.com/forums/en-US/csharpgeneral/thread/faf174a4-dbd6-4aab-a8dc-6d52a8b2ac3b[^]


You can use impersonation for this. You can define it in the config file or you can add that in the code whatever you like.

http://stackoverflow.com/questions/125341/how-do-you-do-impersonation-in-net[^]


这篇关于将文件夹从一个PC复制到服务器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆