共用方式為


VirtualDirectory.LogonMethod 屬性

定義

取得或設定虛擬目錄用來存取已設定實體位置的驗證方法。

public:
 property Microsoft::Web::Administration::AuthenticationLogonMethod LogonMethod { Microsoft::Web::Administration::AuthenticationLogonMethod get(); void set(Microsoft::Web::Administration::AuthenticationLogonMethod value); };
public Microsoft.Web.Administration.AuthenticationLogonMethod LogonMethod { get; set; }
member this.LogonMethod : Microsoft.Web.Administration.AuthenticationLogonMethod with get, set
Public Property LogonMethod As AuthenticationLogonMethod

屬性值

目前虛擬目錄的其中 AuthenticationLogonMethod 一個值。 預設值為 ClearText

範例

下列範例示範如何設定 LogonMethod 虛擬目錄的 屬性。


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();
        }
    }
}

適用於