views:

31

answers:

1

Hello, 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 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
+1  A: 

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.

McAden
Oups! Someone forgot... Dim response As FtpWebResponse = CType(myftprequest.GetResponse, FtpWebResponse)
Chocol8
answer, but no upvote? :P
McAden
Sorry about that. I just upvoted. After all it is free of charge! Thank you.
Chocol8
Thanks, just found it odd
McAden