AuthenticationLogonMethod Enumeration
IIS 7.0
Specifies the kind of authentication that you can use to establish a logon session for a secured virtual directory.
Assembly: Microsoft.Web.Administration (in Microsoft.Web.Administration.dll)
The following example creates a new application under the default Web site. The example then configures the application's default virtual directory to use batch authentication to log on to a UNC path.
using System; using System.Collections.Generic; using System.Text; using Microsoft.Web.Administration; using Microsoft.Web.Management; namespace AdministrationSnippets { public class AdministrationAuthenticationLogonMethod { // Creates a new virtual directory and sets the logon method. public void SetLogonMethod() { ServerManager manager = new ServerManager(); Site defaultSite = manager.Sites["Default Web Site"]; Application reports = defaultSite.Applications.Add( "/reports", @"\\FileServer\Reports"); // Configure the default virtual directory for the application. VirtualDirectory reportDir = reports.VirtualDirectories[0]; reportDir.LogonMethod = AuthenticationLogonMethod.Batch; reportDir.UserName = @"HumanResources\Jane"; reportDir.Password = @"iL@1Fnw!"; manager.CommitChanges(); } } }