我正在使用 Visual Studio 和 Windows Phone 7 开发智能手机 FTP 客户端
我面临一些错误,例如
request.Method = WebRequestMethods.ftp.ListDirectory
错误 1 目标平台不支持后期绑定。C:\Users\Zaheer\Documents\Visual Studio 2010\Projects\PhoneApp4\PhoneApp4\MainPage.xaml.vb 36 30 PhoneApp4
response = CType(request.GetWebResponse(), WebResponse) 错误 2 'GetWebResponse' 不是 'System.Net.WebRequest' 的成员。C:\Users\Zaheer\Documents\Visual Studio 2010\Projects\PhoneApp4\PhoneApp4\MainPage.xaml.vb 37 30 PhoneApp4
这是完整的代码,请帮助我
Dim Request As WebRequest = Nothing
Dim Response As WebResponse = Nothing
Dim reader As StreamReader = Nothing
Dim Port As Integer = 21
Try
Request = CType(WebRequest.Create(URL), WebRequest)
Request.Method = "List"
Request.Credentials = New NetworkCredential(Username, Password)
Request.Method = WebRequestMethods.Ftp.ListDirectory
Response = CType(Response.GetWebRequest(), WebResponse)
reader = New StreamReader(Response.GetResponseStream())
While (reader.Peek() > -1)
RemoteSite.Items.Add(reader.ReadLine())
End While
Catch ex As Exception
Console.WriteLine("List Sucessfully.")
End Try
End Sub