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: 
If you just want to check file information you should try changing the `request.Method` to `WebRequestMethods.Ftp.ListDirectoryDetails` instead: 

```
WebRequest request = WebRequest.Create("ftp://myftp.com");
        request.Method = WebRequestMethods.Ftp.ListDirectoryDetails;
        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.