473,835 Members | 1,888 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Set a anonymous access in virtual directory through VB.NET

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
May 22 '06 #1
2 3912
..Properties("A uthAnonymous")( 0) = False

--
Get a powerful web, database, application, and email hosting with KJM
Solutions
http://www.kjmsolutions.com

"Rose winsle" <ch******@solut ionsit.com.au> wrote in message
news:es******** ******@TK2MSFTN GP03.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.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

May 22 '06 #2
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******@commu nity.nospam> wrote in message
news:%2******** ********@TK2MSF TNGP04.phx.gbl. ..
.Properties("Au thAnonymous")(0 ) = False

--
Get a powerful web, database, application, and email hosting with KJM
Solutions
http://www.kjmsolutions.com

"Rose winsle" <ch******@solut ionsit.com.au> wrote in message
news:es******** ******@TK2MSFTN GP03.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.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


May 23 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
5207
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 or remotely I always ge prompted for user and password. When I provide credentials for user i the admin group the page displays correctly. I do not get prompted when viewing .htm files. I would like to make the aspx pages available anonymously.
1
1619
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 directory for a web app...I go to properties and click on the 'Directory Security' tab, click the 'Edit' button,check anonymous access, type in username/password for account, check 'Integrated Windows authentication' at the bottom...then OK out.
3
2485
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 compiler is not compiling them and where I am going wrong? I am using g++ (GCC) 3.3.5 on a Debian Sarge system. The compiler complains: //**************************** //**************************** Compiler output starts *********** cd /home/red/tmp/testprogs/
2
2907
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 requires a certain level of permissions. The page is running in a virtual server whose anonymous user is a network account with the required permissions. This allows anyone to view the page and see the data. This is working great, however, due to what is being returned, the page load time is longer...
4
2273
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. The machine also has ASP.NET 1.0.3705 installed on it. The machine is win 2k server. IIS is installed. I have already run aspnet_regiis - i to reinstall the .net framework.
0
1788
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 happliy browse up until last week. As of Monday, if I browse to any of the sites, I get an HttpException saying "The directory does not exist or is not accessible because of security settings." I honestly have not changed anything at all. I have checked and re-checked that ASPNET indeed has...
5
6711
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. We also need the user's network id, which we could get from System.Web.HttpContext.User.Identity.Name if we don't allow AA. Is the user's id somehow still accessible in the app even though we're using Anonymous Access?
3
7974
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 denied. - C:\Inetpub\wwwroot\RunReportASP\images C:\Inetpub\wwwroot\RunReportASP is the directory of my virtual directory for my app. In it's properties I did check "Write" as a permission. What else do I need to do?
1
1254
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 secure access that uses forms-based authentication. I'm under the impression that I need 2 web.config files: one in my top level directory for anonymous access and one in my underlying secure directory for authenticated access. Can anyone point e to some specific examples of how to do this, what...
0
9802
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9652
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
10559
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10230
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7765
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5802
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4430
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3990
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3086
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.