473,395 Members | 1,343 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,395 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 2142

"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: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
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...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
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...

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.