如何在asp.net中将文件从一个Web应用程序复制到另一个Web应用程序 [英] How do I copy files from one web application to another in asp .net

查看:96
本文介绍了如何在asp.net中将文件从一个Web应用程序复制到另一个Web应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Hii亲爱的朋友们





你好吗...

我有问题在asp .net web应用程序中复制文件。我想将文件从一个Web应用程序中的文件夹复制到另一个Web应用程序。你能告诉我怎么做吗?





谢谢大家......:)

Hii Dear Friends


how are you all...
I have a problem with file copying in asp .net web application.I would like to copy files from a folder in one web application to another. Could you please tell me how to do this?


Thank You all... :)

推荐答案

使用具有特定用户名和密码的FTP可以解决您的问题。



如果您使用WebServices,有时很难序列化并且在两端都反序列化,有时候你会有文件大小的限制。



最好使用FTP,如果你需要安全使用FTPS。您可以使用WebClient对象与FTP连接。
Using FTP with specific username and password can solve your problem.

If you use WebServices, some times it will be difficult to serialize and de-serialize at both ends and some times you will have constraints with file size.

Better go with FTP, and if you need security use FTPS. Your can use WebClient object to connect with FTP.


you can use webclient :-

private void SaveFileOnFTPLocation(string sourceFile,string ftpPath)
    {
        WebClient webClient = new WebClient();
        webClient.Credentials = new NetworkCredential(@"user", @"pwd");
        string sFtpToReadFileFrom = ftpPath;
        System.IO.File.copy(sourceFile,sFtpToReadFileFrom);
    }


我已经使用了websevices。
I have used websevices for this.


这篇关于如何在asp.net中将文件从一个Web应用程序复制到另一个Web应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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