| Author: santhoshkumar 28 Apr 2008 | Member Level: Gold Points : 2 |
Your code was some what understood please try to give a comments and some explation about the code.
|
| Author: Balamurali Balaji 03 May 2008 | Member Level: Diamond Points : 2 |
Hi santhosh,
Assume that you have a ftp server and few folders that are shared for access. The files in the folder are then available for download and upload. This snippet uses networkcredential to acquire an authentication object to the ftp server. Credential cache is the object that stores the urls, authentication, mode of authentication.
With these two objects, networkcredential and credentialcache, FtpWebRequest object can do the actual uploading or downloading of a particular file.
Hope this is clear.
Goodluck
|
| Author: mahendra 05 May 2008 | Member Level: Gold Points : 2 |
Yeah i also understood code snippet.Its good article which will help me in future.
|
| Author: santhoshkumar 08 May 2008 | Member Level: Gold Points : 2 |
Thank you balaji, now its clear, thank you very much for ur comment
|
| Author: subbarayudu 14 Aug 2008 | Member Level: Silver Points : 2 |
using System; using System.Collections; using System.Configuration; using System.Data; using System.Linq; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.HtmlControls; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Xml.Linq; using System.IO.Ports; using System.Net.Mail; using System.Text;
public partial class FTP1 : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { System.Net.NetworkCredential nc = new System.Net.NetworkCredential("asif", "2july2008"); System.Net.CredentialCache cc = new System.Net.CredentialCache(); cc.Add(new Uri("ftp://192.168.3.210/Rayudu/Rayudu.txt"), "Basic", nc); System.Net.FtpWebRequest wr = (System.Net.FtpWebRequest)System.Net.FtpWebRequest.Create("ftp://192.168.3.210/Rayudu/Rayudu.txt"); wr.Credentials = cc; System.Net.FileWebResponse fwr = (System.Net.FileWebResponse)wr.GetResponse(); System.IO.Stream dataStream = fwr.GetResponseStream(); System.IO.StreamReader reader = new System.IO.StreamReader(dataStream); string responseFromServer = reader.ReadToEnd(); Response.Write(responseFromServer); } }
FTP server IP 192.168.3.210 system have Rayudu folder is there now my system ip 192.168.2.83 I want to copy the Rayudu.txt file into FTP server Rayudu folder I given all permission to Rayudu folder but it is not executing what is ther problem it is giving error at line
webexception unhandled by exception error is coming to this line what i have to do tell me how to recttify this problem System.Net.FileWebResponse fwr = (System.Net.FileWebResponse)wr.GetResponse();
|