开发者

Creating directory in FTP

i am using the following piece of code to create a directory. The problem is that i do not get an error, but i do not also find the directory i justt created.

So, what am开发者_JAVA百科 i doing wrong here? Should i take a break?

 Public Function CreateDirectory(ByVal Dir As String) As Boolean
        Dim myftprequest As Net.FtpWebRequest = CType(FtpWebRequest.Create(FTPSite + Dir), FtpWebRequest)
        myftprequest.Credentials = New NetworkCredential(UserName, Password)
        myftprequest.Method = WebRequestMethods.Ftp.MakeDirectory
        Return True
    End Function


I'm not really a VB person so this syntax might be a bit off but I believe you're missing something along the lines of:

Dim myFtpResponse As Net.FtpWebResponse = CType(request.GetResponse(), FtpWebResponse)

Otherwise you're never actually DOING anything with the request except for creating it.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜