how to delete the virtual directory with the vb.Net ?

C

chenggf

Hi All.

I has been successful to Create the virtual directory of "mytest" with the
function of "Create()",but I don't delete the "mytest"
with the function of "delete1()" or "delete2()" or "delete3()" or
"delete4()"

Thanks all.


chenggf


Public sub Create()
Dim strPath As String = "IIS://localhost/W3SVC/1/ROOT/mytest"
Dim newVirDir As DirectoryEntry =
rootfolder.Children.Add(mytest, "IIsWebVirtualDir")
newVirDir.Invoke("AppCreate", True)
newVirDir.CommitChanges()
rootfolder.CommitChanges()

end sub

public sub delete1()

Dim de As DirectoryEntry = rootfolder.Children.Find("mytest",
"IIsWebVirtualDir")
de.Invoke("AppDelete", True)
de.DeleteTree()

Dim de As DirectoryEntry = rootfolder.Children.Find("mytest",
"IIsWebDirectory")
de.Invoke("AppDelete", True)
de.DeleteTree()


end sub


public sub delete2()
Dim de As DirectoryEntry = rootfolder.Children.Find("mytest",
"IIsWebDirectory")
de.Invoke("AppDelete", True)
de.DeleteTree()
end sub


public sub delete2()
Dim de As DirectoryEntry = rootfolder.Children.Find("mytest",
"IIsWebDirectory")
de.Invoke("AppDelete", True)
de.DeleteTree()
end sub


public sub delete3()

paras(0) = "IIsWebVirtualDir"
paras(1) = "mytest"
rootfolder.Invoke("Delete", paras)
rootfolder.CommitChanges()
end sub



public sub delete4()

paras(0) = "IIsWebDirectory"
paras(1) = "mytest"
rootfolder.Invoke("Delete", paras)
rootfolder.CommitChanges()
end sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,968
Messages
2,570,154
Members
46,702
Latest member
LukasConde

Latest Threads

Top