473,396 Members | 2,089 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Modify IIS Folder Permission

I am trying to change the permission on what I am calling a "web
folder" in IIS.

I tried the code below, but it's not working?

public static void ModifyDirectory(string parent, string ModifyDir)

{

const int MD_AUTH_BASIC = 0x00000002; //Basic
authentication available.

DirectoryEntry folderRoot = new DirectoryEntry(parent);
folderRoot.RefreshCache();
DirectoryEntry modDir;
modDir =
folderRoot.Children.Find(ModifyDir,"IIsWebFileSett ing");

// Set Properties
modDir.CommitChanges();
modDir.Properties["UNCUserName"][0] = "administrator";
modDir.Properties["UNCPassword"][0] = "mae008";
modDir.Properties["DefaultLogonDomain"][0] = "gold-t2";
modDir.Properties["AuthFlags"][0] = MD_AUTH_BASIC;

modDir.CommitChanges();
modDir.Close();
folderRoot.Close();

Thank you,

Mark

Nov 17 '05 #1
2 2143

"Mark" <Ma**@discussions.microsoft.com> wrote in message
news:30**********************************@microsof t.com...
I am trying to change the permission on what I am calling a "web
folder" in IIS.

I tried the code below, but it's not working?

public static void ModifyDirectory(string parent, string ModifyDir)

{

const int MD_AUTH_BASIC = 0x00000002; //Basic
authentication available.

DirectoryEntry folderRoot = new
DirectoryEntry(parent);
folderRoot.RefreshCache();
DirectoryEntry modDir;
modDir =
folderRoot.Children.Find(ModifyDir,"IIsWebFileSett ing");

// Set Properties
modDir.CommitChanges();
modDir.Properties["UNCUserName"][0] =
"administrator";
modDir.Properties["UNCPassword"][0] = "mae008";
modDir.Properties["DefaultLogonDomain"][0] =
"gold-t2";
modDir.Properties["AuthFlags"][0] = MD_AUTH_BASIC;

modDir.CommitChanges();
modDir.Close();
folderRoot.Close();

Thank you,

Mark


These properties are not valid for IIsWebFileSetting, they belong to
IIsWebVirtualDir.
I guess to misunderstood the purpose of these properties, what are you
trying to achieve?

Willy.
Nov 17 '05 #2
Sorry about that...my description was weak!

I need to change Directory Security permission on folders under the IIS
default web site tree:

Internet Information Services
- Machine Name
- Web Sites
-Default Web Site
+testfolder

Specifically: on the the Directory Securty Tab (right click on a folder
under the Default Web Site) click the edit button next to Anonymous access
and authentication control, uncheck Anonymous access, check Basic
authenticatoin and enter Domain and password...and finally uncheck Integrated
Windows authentication.

I may have chosen the wrong class "IIsWebFileSetting" to change the
properties described above...which also could have added to the confusion.

I am using windows server 2000, with IIS 5.0

I know in the end we are really just changing/entering data in the IIS
metabase, right?

Thank you so much for taking the time to help....I'm really stuck on this one.

Mark

Nov 17 '05 #3

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

Similar topics

0
by: Mark | last post by:
I need to change Directory Security permission on folders under the IIS default web site tree: Internet Information Services - Machine Name - Web Sites -Default Web Site +testfolder ...
2
by: Chen Zhuo | last post by:
Hi, I need to write some code to test whether a folder has read/write permission. The idea is to try to read sub-directories in this folder, if succeed, then test whether it's read-only. Any...
2
by: ralderton | last post by:
How can you set folder permissions from an asp.net (vb.net) Web app I want to dynamically create folder and assign full permissions to only system and a specific user account Thanks
3
by: A P | last post by:
Do I need to give a read permission for "Everyone" on the WWWroot in order for me to use ASP.NET Code? I notice this when I only add the IUSR account of my machine to have change permission on the...
4
by: Santaji | last post by:
Hi, We have an ASP.NET application which needs to write some files on the disk. For these we need to give ASP.NET user the Write permission for that particular folder. This is possible from...
5
by: Mitchell S. Honnert | last post by:
Is there a way, given the full path of a folder on a network, that one can programatically tell if you have Read access to that folder? I have an application where the user is able to select a...
8
by: Paw | last post by:
Greetings. I use asp. what I need is is when a visitor comes to the site, I need it to check the host name. if "www.hometowndigest.com" is the host, then check a folder named "something" and if...
26
by: Trish | last post by:
I have an Access 2003 database application consisting of a frontend on each user's desktop and a backend on a network drive. I have been asked to move the backend into a folder that the users...
2
by: Bill Fallon | last post by:
I have a VS2005 VB.Net windows form application deployed to a share drive. The windows explorer security permissions for this application (.exe) file is set for Everyone with List Folder/Read Data...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.