更新时间:2022-11-05 13:43:51
您好,
如果共享服务器路径,您可以将任何文件保存到服务器。
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 [ ^ ]
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[^]