Question: I have added the following code in my C#.net application in visual studio 2010

```
 WebRequest request = WebRequest.Create("ftp://myftp.com");
            request.Method = WebRequestMethods.Ftp.MakeDirectory;
            request.Credentials = new NetworkCredential("myusername", "12344");
            using (var resp = (FtpWebResponse)request.GetResponse())
            {
                Console.WriteLine(resp.StatusCode);
            }

```

But I am getting following error.

```
The requested URI is invalid for this FTP command.

```

Please suggest solution. Thanks

Answer: 
Uri should be ftp:// + IP or ftpServerName + / Folder\_to\_create\_Name

So, see follow code:

```
 WebRequest request = WebRequest.Create("ftp://myftp.com/FOLDER_TO_CREATE/");
 request.Method = WebRequestMethods.Ftp.MakeDirectory;
 request.Credentials = new NetworkCredential("myusername", "12344");

 using (var resp = (FtpWebResponse)request.GetResponse())
 {
       Console.WriteLine(resp.StatusCode);
 }

```
You must specify a sub-directory you wish to create; you can't create the root, which is what it appears you are trying to do. Hence the error.