473,569 Members | 2,601 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.Refr eshCache();
DirectoryEntry modDir;
modDir =
folderRoot.Chil dren.Find(Modif yDir,"IIsWebFil eSetting");

// Set Properties
modDir.CommitCh anges();
modDir.Properti es["UNCUserNam e"][0] = "administrator" ;
modDir.Properti es["UNCPasswor d"][0] = "mae008";
modDir.Properti es["DefaultLogonDo main"][0] = "gold-t2";
modDir.Properti es["AuthFlags"][0] = MD_AUTH_BASIC;

modDir.CommitCh anges();
modDir.Close();
folderRoot.Clos e();

Thank you,

Mark

Nov 17 '05 #1
2 2156

"Mark" <Ma**@discussio ns.microsoft.co m> wrote in message
news:30******** *************** ***********@mic rosoft.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.Refr eshCache();
DirectoryEntry modDir;
modDir =
folderRoot.Chil dren.Find(Modif yDir,"IIsWebFil eSetting");

// Set Properties
modDir.CommitCh anges();
modDir.Properti es["UNCUserNam e"][0] =
"administrator" ;
modDir.Properti es["UNCPasswor d"][0] = "mae008";
modDir.Properti es["DefaultLogonDo main"][0] =
"gold-t2";
modDir.Properti es["AuthFlags"][0] = MD_AUTH_BASIC;

modDir.CommitCh anges();
modDir.Close();
folderRoot.Clos e();

Thank you,

Mark


These properties are not valid for IIsWebFileSetti ng, they belong to
IIsWebVirtualDi r.
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 "IIsWebFileSett ing" 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
396
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 Specifically: on the the Directory Securty Tab (right click on a folder
2
5686
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 exception thrown means we don't have permission to access this folder: bool IsDirectoryAccessible(string path) { try
2
2159
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
1821
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 said folder, and it already give me an error: Server Error in '/' Application. So I try adding the "Everyone" with Read permission and it worked!...
4
2534
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 Windows explorer. We don't want to given permission from Windows Explorer. Is there any way of giving Write permission for folder through code ? We want...
5
13260
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 number of search folders using the standard dialog control. There shouldn't be an issue with the search folder being on a local drive or a network...
8
2563
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 the folder does not exsist, create folder "www" and then copy folder "temp" and its contents. If the folder "www" is there, look in it, check to...
26
2946
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 can't actually see from Windows Explorer - a folder for which only a few of us have privileges. The fear is that someone will accidentally delete or...
2
10682
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 not allowed. This is done so that users cannot take away a copy of the .exe file. When I execute the ..exe from the client computer I get .Net...
0
7615
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...
0
7924
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8130
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7677
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...
0
5219
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3643
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2115
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
1
1223
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
940
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...

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.