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.DirectoryServices.DirectoryEntry("IIS://"
& WebSite & "/Schema/AppIsolated")
Dim CanCreate As Boolean = Not
IISSchema.Properties("Syntax").Value.ToString.ToUp per() = "BOOLEAN"
IISSchema.Dispose()
If CanCreate Then
Dim PathCreated As Boolean
Try
Dim IISAdmin As New
System.DirectoryServices.DirectoryEntry("IIS://" & WebSite &
"/W3SVC/1/Root")
'make sure folder exists
If Not System.IO.Directory.Exists(Path) Then
System.IO.Directory.CreateDirectory(Path)
PathCreated = True
End If
'If the virtual directory already exists then delete it
For Each VD As System.DirectoryServices.DirectoryEntry In
IISAdmin.Children
If VD.Name = AppName Then
'IISAdmin.Invoke("Delete", New String()
{VD.SchemaClassName, AppName})
'IISAdmin.CommitChanges()
MsgBox("Virtual directory already exists..!.",
MsgBoxStyle.Information, "Create Virtual Directory")
Exit Sub
End If
Next VD
'Create and setup new virtual directory
Dim VDir As System.DirectoryServices.DirectoryEntry =
IISAdmin.Children.Add(AppName, "IIsWebVirtualDir")
VDir.Properties("Path").Item(0) = Path
VDir.Properties("AppFriendlyName").Item(0) = AppName
VDir.Properties("EnableDirBrowsing").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").Item(0) = False 'Integreted
Windows Authontocation
VDir.Properties("EnableDefaultDoc").Item(0) = True
VDir.Properties("DefaultDoc").Item(0) =
"default.aspx,default.htm,default.asp"
VDir.Properties("AspEnableParentPaths").Item(0) = True
VDir.CommitChanges()
VDir.Invoke("AppCreate", 1)
So can you please tell me how to set Anonymous access OFF.
-Rosy
- R 2 3805
..Properties("AuthAnonymous")(0) = False
--
Get a powerful web, database, application, and email hosting with KJM
Solutions http://www.kjmsolutions.com
"Rose winsle" <ch******@solutionsit.com.au> wrote in message
news:es**************@TK2MSFTNGP03.phx.gbl... 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.DirectoryServices.DirectoryEntry("IIS://" & WebSite & "/Schema/AppIsolated") Dim CanCreate As Boolean = Not IISSchema.Properties("Syntax").Value.ToString.ToUp per() = "BOOLEAN" IISSchema.Dispose()
If CanCreate Then Dim PathCreated As Boolean
Try Dim IISAdmin As New System.DirectoryServices.DirectoryEntry("IIS://" & WebSite & "/W3SVC/1/Root")
'make sure folder exists If Not System.IO.Directory.Exists(Path) Then System.IO.Directory.CreateDirectory(Path) PathCreated = True End If
'If the virtual directory already exists then delete it For Each VD As System.DirectoryServices.DirectoryEntry In IISAdmin.Children If VD.Name = AppName Then 'IISAdmin.Invoke("Delete", New String() {VD.SchemaClassName, AppName}) 'IISAdmin.CommitChanges() MsgBox("Virtual directory already exists..!.", MsgBoxStyle.Information, "Create Virtual Directory") Exit Sub End If Next VD
'Create and setup new virtual directory Dim VDir As System.DirectoryServices.DirectoryEntry = IISAdmin.Children.Add(AppName, "IIsWebVirtualDir") VDir.Properties("Path").Item(0) = Path VDir.Properties("AppFriendlyName").Item(0) = AppName VDir.Properties("EnableDirBrowsing").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").Item(0) = False 'Integreted Windows Authontocation VDir.Properties("EnableDefaultDoc").Item(0) = True VDir.Properties("DefaultDoc").Item(0) = "default.aspx,default.htm,default.asp" VDir.Properties("AspEnableParentPaths").Item(0) = True
VDir.CommitChanges()
VDir.Invoke("AppCreate", 1)
So can you please tell me how to set Anonymous access OFF.
-Rosy - R
Hi vbnetdev,
Thanks for the reply .. but i tried this. it gives me follwing error
"Index was out of range.Must be non-negative and less than the size of
collection, parameter name :Index"
pls help me
-Rose
"vbnetdev" <vb******@community.nospam> wrote in message
news:%2****************@TK2MSFTNGP04.phx.gbl... .Properties("AuthAnonymous")(0) = False
-- Get a powerful web, database, application, and email hosting with KJM Solutions http://www.kjmsolutions.com "Rose winsle" <ch******@solutionsit.com.au> wrote in message news:es**************@TK2MSFTNGP03.phx.gbl... 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.DirectoryServices.DirectoryEntry("IIS://" & WebSite & "/Schema/AppIsolated") Dim CanCreate As Boolean = Not IISSchema.Properties("Syntax").Value.ToString.ToUp per() = "BOOLEAN" IISSchema.Dispose()
If CanCreate Then Dim PathCreated As Boolean
Try Dim IISAdmin As New System.DirectoryServices.DirectoryEntry("IIS://" & WebSite & "/W3SVC/1/Root")
'make sure folder exists If Not System.IO.Directory.Exists(Path) Then System.IO.Directory.CreateDirectory(Path) PathCreated = True End If
'If the virtual directory already exists then delete it For Each VD As System.DirectoryServices.DirectoryEntry In IISAdmin.Children If VD.Name = AppName Then 'IISAdmin.Invoke("Delete", New String() {VD.SchemaClassName, AppName}) 'IISAdmin.CommitChanges() MsgBox("Virtual directory already exists..!.", MsgBoxStyle.Information, "Create Virtual Directory") Exit Sub End If Next VD
'Create and setup new virtual directory Dim VDir As System.DirectoryServices.DirectoryEntry = IISAdmin.Children.Add(AppName, "IIsWebVirtualDir") VDir.Properties("Path").Item(0) = Path VDir.Properties("AppFriendlyName").Item(0) = AppName VDir.Properties("EnableDirBrowsing").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").Item(0) = False 'Integreted Windows Authontocation VDir.Properties("EnableDefaultDoc").Item(0) = True VDir.Properties("DefaultDoc").Item(0) = "default.aspx,default.htm,default.asp" VDir.Properties("AspEnableParentPaths").Item(0) = True
VDir.CommitChanges()
VDir.Invoke("AppCreate", 1)
So can you please tell me how to set Anonymous access OFF.
-Rosy - R
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: muzerb |
last post by:
What are the account requirements for aspx pages to be accesse
anonymously on Windows 2003 server?.
When I view my aspx page in a browser locally...
|
by: yurps |
last post by:
Hello,
I got a weird problem...I didn't set up this machine so I don't know
what possibly went wrong...IIS set up after VS.NET..
On a virtual...
|
by: H. S. |
last post by:
Hi,
I am trying to compile these set of C++ files and trying out class
inheritence and function pointers. Can anybody shed some light why my...
|
by: Kevin Hoskins |
last post by:
Is there anyway to force authentication of the Anonymous user?
Here is the situation:
I have an ASP.NET page which calls an assembly which...
|
by: Martin |
last post by:
Hi,
I am getting an "Access Denied" error when attempting to browse asp.net
pages.
I have installed ASP.NET 1.1.4322 on a domain controller....
|
by: Yogesh Pancholi |
last post by:
For some unexplained reason, I am suddenly unable to browse to a virtual
directory on my laptop. I have a number of sample websites to which I could...
|
by: jhcorey |
last post by:
We're using a third-party treeview and found that the functionality we
need
works only when we set the web site security to allow Anonymous Access....
|
by: David Thielen |
last post by:
Hi;
I created a virtual directory in IIS 6.0 and my asp.net app runs fine. But
when it tries to write a file I get:
Access to the path is...
|
by: AAOMTim |
last post by:
I have a web project in which I would like to structure my top level
directory to provide a user with anonymous access and a subdirectory for...
|
by: Kemmylinns12 |
last post by:
Blockchain technology has emerged as a transformative force in the business world, offering unprecedented opportunities for innovation and...
|
by: jalbright99669 |
last post by:
Am having a bit of a time with URL Rewrite. I need to incorporate http to https redirect with a reverse proxy. I have the URL Rewrite rules made...
|
by: AndyPSV |
last post by:
HOW CAN I CREATE AN AI with an .executable file that would suck all files in the folder and on my computerHOW CAN I CREATE AN AI with an .executable...
|
by: Arjunsri |
last post by:
I have a Redshift database that I need to use as an import data source. I have configured the DSN connection using the server, port, database, and...
|
by: WisdomUfot |
last post by:
It's an interesting question you've got about how Gmail hides the HTTP referrer when a link in an email is clicked. While I don't have the specific...
|
by: Matthew3360 |
last post by:
Hi,
I have been trying to connect to a local host using php curl. But I am finding it hard to do this. I am doing the curl get request from my web...
|
by: Carina712 |
last post by:
Setting background colors for Excel documents can help to improve the visual appeal of the document and make it easier to read and understand....
|
by: BLUEPANDA |
last post by:
At BluePanda Dev, we're passionate about building high-quality software and sharing our knowledge with the community. That's why we've created a SaaS...
|
by: Rahul1995seven |
last post by:
Introduction:
In the realm of programming languages, Python has emerged as a powerhouse. With its simplicity, versatility, and robustness, Python...
| |