設定基本驗證。
Syntax
class BasicAuthenticationSection : ConfigurationSection
方法
下表列出 類別所 BasicAuthenticationSection 公開的方法。
| 名稱 | 描述 |
|---|---|
| GetAllowDefinition | (繼承自 ConfigurationSection.) |
| GetAllowLocation | (繼承自 ConfigurationSection。) |
| RevertToParent | (繼承自 ConfigurationSection。) |
| SetAllowDefinition | (繼承自 ConfigurationSection。) |
| SetAllowLocation | (繼承自 ConfigurationSection。) |
屬性
下表列出 類別所 BasicAuthenticationSection 公開的屬性。
| 名稱 | 描述 |
|---|---|
DefaultLogonDomain |
讀取/寫入 string 值,指定當用戶端未在登入對話方塊中指定網域時,伺服器用來驗證使用者的預設網域。 |
Enabled |
讀取/寫入 boolean 值。 true 如果已啟用基本驗證,則為 ;否則為 false 。 預設值為 false。 |
Location |
(繼承自 ConfigurationSection .) 索引鍵屬性。 |
LogonMethod |
讀取/寫入 sint32 列舉,指定本機使用者的預設登入方法。 登入類型會判斷產生的權杖是否可以從遠端使用。 可能的值稍後會列在一節中。 |
Path |
(繼承自 ConfigurationSection .) 索引鍵屬性。 |
Realm |
讀取/寫入 string 值,其中包含用戶端用於認證快取的領域名稱稱。 |
SectionInformation |
(繼承自 ConfigurationSection。) |
子類別
這個類別不包含子類別。
備註
下表包含 屬性的可能值 LogonMethod 。 預設值為 3 (ClearText) 。 如需詳細資訊,請參閱 LogonUserEx 函式。
| 值 | 關鍵字 | 描述 |
|---|---|---|
| 0 | Interactive |
此登入類型適用于以互動方式使用電腦的使用者。 |
| 1 | Batch |
此登入類型適用于批次伺服器,其中進程可能會代表使用者執行,而不需直接介入。 此登入類型不會快取認證。 |
| 2 | Network |
此登入類型適用于高效能伺服器來驗證純文字密碼。 此登入類型不會快取認證。 |
| 3 | ClearText |
此登入類型會保留驗證套件中的名稱和密碼,這可讓伺服器在模擬用戶端時連線到其他網路伺服器。 |
範例
下列範例會顯示 BasicAuthenticationSection 預設網站的組態。
' Connect to the WMI WebAdministration namespace.
Set oWebAdmin = _
GetObject("winmgmts:root\WebAdministration")
' Get the Basic authentication section for the default Web site.
Set oSite = oWebAdmin.Get("Site.Name='Default Web Site'")
oSite.GetSection "BasicAuthenticationSection", oBasicAuth
' Display the path and location.
WScript.Echo "Basic Authentication Settings"
WScript.Echo "-----------------------------"
WScript.Echo "Path: " & oBasicAuth.Path
WScript.Echo "Location: " & oBasicAuth.Location
WScript.Echo
' Display the Enabled, DefaultLogonDomain, Realm, and
' LogonMethod properties.
WScript.Echo "Enabled: " & _
"[" & oBasicAuth.Enabled & "]"
WScript.Echo "DefaultLogonDomain: " & _
"[" & oBasicAuth.DefaultLogonDomain & "]"
WScript.Echo "Realm: " & "[" & oBasicAuth.Realm & "]"
WScript.Echo "LogonMethod: " & _
"[" & GetLogonMethodText(oBasicAuth.LogonMethod) & "]"
' Translate the LogonMethod enumeration values to text.
Function GetLogonMethodText(LogonMethodValue)
Select Case LogonMethodValue
Case 0
GetLogonMethodText = "Interactive"
Case 1
GetLogonMethodText = "Batch"
Case 2
GetLogonMethodText = "Network"
Case 3
GetLogonMethodText = "ClearText"
Case Else
GetLogonMethodText = "Undefined enumeration."
End Select
End Function
繼承階層架構
BasicAuthenticationSection
規格需求
| 類型 | 描述 |
|---|---|
| Client | - Windows Vista 上的 IIS 7.0 - Windows 7 上的 IIS 7.5 - Windows 8 上的 IIS 8.0 - Windows 10上的 IIS 10.0 |
| 伺服器 | - Windows Server 2008 上的 IIS 7.0 - Windows Server 2008 R2 上的 IIS 7.5 - Windows Server 2012 上的 IIS 8.0 - Windows Server 2012 R2 上的 IIS 8.5 - Windows Server 2016上的 IIS 10.0 |
| 產品 | - IIS 7.0、IIS 7.5、IIS 8.0、IIS 8.5、IIS 10.0 |
| MOF 檔案 | WebAdministration.mof |
另請參閱
AnonymousAuthenticationSection 類別
AuthenticationSection 類別
ClientCertificateMappingAuthenticationSection 類別
DigestAuthenticationSection 類別
FormsAuthenticationConfiguration 類別
FormsAuthenticationCredentials 類別
FormsAuthenticationUser 類別
IisClientCertificateMappingAuthenticationSection 類別
PassportAuthentication 類別
WindowsAuthenticationSection 類別
LogonUserEx