首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Windows 7 Ftp客户端

Windows 7 Ftp客户端
EN

Stack Overflow用户
提问于 2013-07-01 09:38:26
回答 1查看 175关注 0票数 0

我正在使用visual studio和windows phone 7开发智能手机ftp客户端。

我面临着一些错误,比如

WebRequestMethods.ftp.ListDirectory request.Method =

错误1目标平台不支持后期绑定。C:\User\Zaheer\Documents\Visual 2010\Projects\PhoneApp4\PhoneApp4\MainPage.xaml.vb 36 30 PhoneApp4

response = CType(request.GetWebResponse(),WebResponse) Error 2 'GetWebResponse‘不是System.Net.WebRequest的成员。C:\User\Zaheer\Documents\Visual 2010\Projects\PhoneApp4\PhoneApp4\MainPage.xaml.vb 37 30 PhoneApp4

,这是完整的代码,请帮我

代码语言:javascript
复制
    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
EN

回答 1

Stack Overflow用户

发布于 2013-07-01 11:04:56

对于后期绑定错误,需要将要设置的对象转换为正确的数据类型,因为WP7不支持类型的运行时评估(后期绑定)。

至于GetWebResponse的错误,编译器是绝对正确的,WebRequest (甚至HttpWebRequest)没有GetWebResponse方法,也许您正在寻找WebRequest.GetResponse

例如:

代码语言:javascript
复制
response = request.GetResponse(); // where request is of type WebRequest or a derived class
票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/17401332

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档