V
Vincent Mouton
Hi,
I am trying to add an FTP Virtual Directory to IIS through C# code in an
ASP.NET page.
I'm getting an Access Denied Error when running the code below. I've left
out the code adding the directory itself.
For debugging purposes I tried to only execute the code below
(RefreshCache(), and even then I received that error.
From the beginning on, I've added the Username and Password property to the
DirectoryEntry instance.
See my code below.
note: target, username and password are parameters passed through a method
that holds this code.
DirectoryEntry folderRoot = new DirectoryEntry("IIS://" + target +
"/MSFTPSVC/1/Root");
folderRoot.Username = username;
folderRoot.Password = password;
folderRoot.RefreshCache();
Right before executing this, I managed to add a user account using this
instance of DirectoryEntry class.
DirectoryEntry AD = new DirectoryEntry("WinNT://" + target +
",computer",username,password);
(....)
And I managed to add a New Website in IIS (not a virtual directory) using an
WMI wrapper (ManagementClass, ManagementObject, etc...).
With the same UserName and Password as I tried to use to add the FTP virtual
directory.
thank you in advance,
Vincent
I am trying to add an FTP Virtual Directory to IIS through C# code in an
ASP.NET page.
I'm getting an Access Denied Error when running the code below. I've left
out the code adding the directory itself.
For debugging purposes I tried to only execute the code below
(RefreshCache(), and even then I received that error.
From the beginning on, I've added the Username and Password property to the
DirectoryEntry instance.
See my code below.
note: target, username and password are parameters passed through a method
that holds this code.
DirectoryEntry folderRoot = new DirectoryEntry("IIS://" + target +
"/MSFTPSVC/1/Root");
folderRoot.Username = username;
folderRoot.Password = password;
folderRoot.RefreshCache();
Right before executing this, I managed to add a user account using this
instance of DirectoryEntry class.
DirectoryEntry AD = new DirectoryEntry("WinNT://" + target +
",computer",username,password);
(....)
And I managed to add a New Website in IIS (not a virtual directory) using an
WMI wrapper (ManagementClass, ManagementObject, etc...).
With the same UserName and Password as I tried to use to add the FTP virtual
directory.
thank you in advance,
Vincent