Repository navigation
Expand file tree
/
Copy pathftpclient.aspx.cs
More file actions
84 lines (70 loc) · 1.92 KB
/
Copy pathftpclient.aspx.cs
File metadata and controls
84 lines (70 loc) · 1.92 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using CleverComponents.InetSuite;
namespace inetsuitedemocs
{
/// <summary>
/// Summary description for ftpclient.
/// </summary>
public partial class ftpclient : System.Web.UI.Page
{
protected CleverComponents.InetSuite.Ftp ftp1;
protected void Page_Load(object sender, System.EventArgs e)
{
// Put user code to initialize the page here
}
#region Web Form Designer generated code
override protected void OnInit(EventArgs e)
{
//
// CODEGEN: This call is required by the ASP.NET Web Form Designer.
//
InitializeComponent();
base.OnInit(e);
}
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.ftp1 = new CleverComponents.InetSuite.Ftp();
}
#endregion
protected void Button1_Click(object sender, System.EventArgs e) {
ftp1.Server = edtServer.Text;
ftp1.Port = StringUtils.StrToIntDef(edtPort.Text, 21);
ftp1.UserName = edtUser.Text;
ftp1.Password = edtPassword.Text;
ftp1.Open();
string dir = edtCurrentDir.Text;
if (!StringUtils.IsEmpty(dir)) {
ftp1.ChangeCurrentDir(dir);
}
DataTable files = new DataTable();
files.Columns.Add("filename");
ftp1.DirectoryListing += delegate(object sender1, DirectoryListingEventArgs args) {
DataRow row = files.NewRow();
files.Rows.Add(row);
if (args.FileInfo.IsDirectory) {
row["filename"] = "/" + args.FileInfo.FileName;
}
else {
row["filename"] = args.FileInfo.FileName;
}
};
ftp1.GetDirectoryListing();
DataGrid1.DataSource = files;
DataGrid1.DataBind();
ftp1.Close();
}
}
}