如何使用带有c#的Windows应用程序上传服务器文件夹中的文件? [英] How to upload files in server folder using windows application with c#?
本文介绍了如何使用带有c#的Windows应用程序上传服务器文件夹中的文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
大家好,
如何使用c#使用Windows应用程序保存服务器文件夹中的文件?
谢谢和问候,
Murali.K
Hi All,
How to save files in server folder using windows application with c#?
Thanks and Regards,
Murali.K
推荐答案
您好,
如果共享服务器路径,您可以将任何文件保存到服务器。
EG
Hi,
You can save any file to sever if the server path is shared.
E.G.
AppDomain.CurrentDomain.SetPrincipalPolicy(PrincipalPolicy.WindowsPrincipal);
WindowsIdentity identity = new WindowsIdentity(username, password);
WindowsImpersonationContext context = identity.Impersonate();
try
{
File.Copy(@"c:\temp\File.txt", @"\\server Name or IP\folder\File.txt", true);
}
catch
{
context.Undo();
}
嗨
我建议使用FTP。
http://www.vcskicks.com/csharp_ftp_upload.php [ ^ ]
http://www.techrepublic.com/blog/howdoi/how-do-i-use-c-to-upload-and-download-files-from-an-ftp-server/165 [< a href =http://www.techrepublic.com/blog/howdoi/how-do-i-use-c-to-upload-and-download-files-from-an-ftp-server/165target = _blanktitle =新窗口> ^ ]
http://www.c-sharpcorner.com/UploadFile/neo_matrix/SimpleFTP01172007082222AM/SimpleFTP.aspx [ ^ ]
Hi
I''d recommend using FTP.
http://www.vcskicks.com/csharp_ftp_upload.php[^]
http://www.techrepublic.com/blog/howdoi/how-do-i-use-c-to-upload-and-download-files-from-an-ftp-server/165[^]
http://www.c-sharpcorner.com/UploadFile/neo_matrix/SimpleFTP01172007082222AM/SimpleFTP.aspx[^]
这篇关于如何使用带有c#的Windows应用程序上传服务器文件夹中的文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文