Saar Carmi

A .NET Blog

<August 2008>
SuMoTuWeThFrSa
272829303112
3456789
10111213141516
17181920212223
24252627282930
31123456


Navigation

Subscriptions

Post Categories



Setting IIS to support Windows Authentication and Content Expiration by code

I was wondering how to set the IIS virtual directory to Windows Authentication during the application install time.

Well, here is the code snip.

 

Using System.DirectoryServices;

const int MD_AUTH_NT = 0x00000004; //Windows authentication schemes available.

DirectoryEntry folderRoot = new DirectoryEntry("IIS://localhost/W3SVC/1/Root/" + virutalDirecty);

folderRoot.RefreshCache();

folderRoot.Properties["AuthFlags"].Value = MD_AUTH_NT; //Windows authentication

folderRoot.Properties["HttpExpires"].Value = "D, 86400"; //Content expiration after 1 day

folderRoot.CommitChanges();

}

posted on Monday, November 29, 2004 2:32 AM by saarc





Powered by Dot Net Junkies, by Telligent Systems