Hi guys ...
I just wanted to create virtual directory using VB.net . i can manage that
... when i create the virtual directory how can i set anonymous access off.
following is my code
==============
Dim IISSchema As New System.Director yServices.Direc toryEntry("IIS://"
& WebSite & "/Schema/AppIsolated")
Dim CanCreate As Boolean = Not
IISSchema.Prope rties("Syntax") .Value.ToString .ToUpper() = "BOOLEAN"
IISSchema.Dispo se()
If CanCreate Then
Dim PathCreated As Boolean
Try
Dim IISAdmin As New
System.Director yServices.Direc toryEntry("IIS://" & WebSite &
"/W3SVC/1/Root")
'make sure folder exists
If Not System.IO.Direc tory.Exists(Pat h) Then
System.IO.Direc tory.CreateDire ctory(Path)
PathCreated = True
End If
'If the virtual directory already exists then delete it
For Each VD As System.Director yServices.Direc toryEntry In
IISAdmin.Childr en
If VD.Name = AppName Then
'IISAdmin.Invok e("Delete", New String()
{VD.SchemaClass Name, AppName})
'IISAdmin.Commi tChanges()
MsgBox("Virtual directory already exists..!.",
MsgBoxStyle.Inf ormation, "Create Virtual Directory")
Exit Sub
End If
Next VD
'Create and setup new virtual directory
Dim VDir As System.Director yServices.Direc toryEntry =
IISAdmin.Childr en.Add(AppName, "IIsWebVirtualD ir")
VDir.Properties ("Path").Item(0 ) = Path
VDir.Properties ("AppFriendlyNa me").Item(0) = AppName
VDir.Properties ("EnableDirBrow sing").Item(0) = False
VDir.Properties ("AccessRead"). Item(0) = True
VDir.Properties ("AccessExecute ").Item(0) = False '
VDir.Properties ("AccessWrite") .Item(0) = False
VDir.Properties ("AccessScript" ).Item(0) = True
VDir.Properties ("AuthNTLM").It em(0) = False 'Integreted
Windows Authontocation
VDir.Properties ("EnableDefault Doc").Item(0) = True
VDir.Properties ("DefaultDoc"). Item(0) =
"default.aspx,d efault.htm,defa ult.asp"
VDir.Properties ("AspEnablePare ntPaths").Item( 0) = True
VDir.CommitChan ges()
VDir.Invoke("Ap pCreate", 1)
So can you please tell me how to set Anonymous access OFF.
-Rosy
- R
I just wanted to create virtual directory using VB.net . i can manage that
... when i create the virtual directory how can i set anonymous access off.
following is my code
==============
Dim IISSchema As New System.Director yServices.Direc toryEntry("IIS://"
& WebSite & "/Schema/AppIsolated")
Dim CanCreate As Boolean = Not
IISSchema.Prope rties("Syntax") .Value.ToString .ToUpper() = "BOOLEAN"
IISSchema.Dispo se()
If CanCreate Then
Dim PathCreated As Boolean
Try
Dim IISAdmin As New
System.Director yServices.Direc toryEntry("IIS://" & WebSite &
"/W3SVC/1/Root")
'make sure folder exists
If Not System.IO.Direc tory.Exists(Pat h) Then
System.IO.Direc tory.CreateDire ctory(Path)
PathCreated = True
End If
'If the virtual directory already exists then delete it
For Each VD As System.Director yServices.Direc toryEntry In
IISAdmin.Childr en
If VD.Name = AppName Then
'IISAdmin.Invok e("Delete", New String()
{VD.SchemaClass Name, AppName})
'IISAdmin.Commi tChanges()
MsgBox("Virtual directory already exists..!.",
MsgBoxStyle.Inf ormation, "Create Virtual Directory")
Exit Sub
End If
Next VD
'Create and setup new virtual directory
Dim VDir As System.Director yServices.Direc toryEntry =
IISAdmin.Childr en.Add(AppName, "IIsWebVirtualD ir")
VDir.Properties ("Path").Item(0 ) = Path
VDir.Properties ("AppFriendlyNa me").Item(0) = AppName
VDir.Properties ("EnableDirBrow sing").Item(0) = False
VDir.Properties ("AccessRead"). Item(0) = True
VDir.Properties ("AccessExecute ").Item(0) = False '
VDir.Properties ("AccessWrite") .Item(0) = False
VDir.Properties ("AccessScript" ).Item(0) = True
VDir.Properties ("AuthNTLM").It em(0) = False 'Integreted
Windows Authontocation
VDir.Properties ("EnableDefault Doc").Item(0) = True
VDir.Properties ("DefaultDoc"). Item(0) =
"default.aspx,d efault.htm,defa ult.asp"
VDir.Properties ("AspEnablePare ntPaths").Item( 0) = True
VDir.CommitChan ges()
VDir.Invoke("Ap pCreate", 1)
So can you please tell me how to set Anonymous access OFF.
-Rosy
- R
Comment