469,951 Members | 2,583 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,951 developers. It's quick & easy.

Create FTP Server & Virtual directory

After looking all the ways to progrrammatically create a new FTP Server &
Virtual Directory, I have come to see that the code below is the cleanest.
Here is my basic issue. When I run this code, I successfully create a new
FTP Server and virtual directory. The strange this is that the description
of the new server is (Stopped) and the status has the following warning "The
specified metadata was not found.". If I manually Stop the individual
server and restart it, it comes back clean and all is well. No matter what
I do, I cannot get it to create successfully in a Running state. This exact
same code, except for the different properties, works for creating a new Web
Site and does so without complaint. All of this is on a Windows 2003 server
using .NET v1.1 completely packed and up to date. The physical path exists
and it is not permissions.

Any help or insight would be greatly appreciated!

private void CreateFTP()
DirectoryEntry root = new DirectoryEntry("IIS://localhost/MSFTPSVC");
// Create web site
Random r = new Random();
int siteID = r.Next(100000000, 1000000000);
DirectoryEntry site = (DirectoryEntry)root.Invoke("Create",
"IIsFtpServer", Convert.ToString(siteID));
site.Invoke("Put", "ServerComment", "test.com");
site.Invoke("Put", "ServerBindings", "");

// Create virtual directory
DirectoryEntry siteVDir = site.Children.Add("ROOT", "IISFtpVirtualDir");
siteVDir.Properties["Path"][0] = "d:\\internet2\\www\\test";

Thx in Advance - Jamie
Nov 17 '05 #1
0 2332

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by Smitha Nataraj | last post: by
18 posts views Thread by UJ | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.