AuthenticationSection Class1
Настраивает проверку подлинности ASP.NET.
Синтаксис
class AuthenticationSection : ConfigurationSectionWithCollection
Методы
В следующей таблице перечислены методы, предоставляемые классом AuthenticationSection
.
Имя | Описание |
---|---|
Добавление | (Наследуется от ConfigurationSectionWithCollection.) |
Очистить | (Является наследником ConfigurationSectionWithCollection ) |
Get | (Является наследником ConfigurationSectionWithCollection ) |
GetAllowDefinition | (Наследуется от ConfigurationSection.) |
GetAllowLocation | (Является наследником ConfigurationSection ) |
Удалить | (Является наследником ConfigurationSectionWithCollection ) |
RevertToParent | (Является наследником ConfigurationSection ) |
SetAllowDefinition | (Является наследником ConfigurationSection ) |
SetAllowLocation | (Является наследником ConfigurationSection ) |
Свойства
В следующей таблице перечислены свойства, предоставляемые классом AuthenticationSection
.
Имя | Описание |
---|---|
Forms |
Значение FormsAuthenticationConfiguration , которое настраивает проверку подлинности с помощью форм для веб-приложения. |
Location |
(Наследуется от ConfigurationSection .) Свойство ключа. |
Mode |
Значение для чтения и записи sint32 , указывающее режим проверки подлинности для веб-приложения. Возможные значения перечислены далее в разделе Примечания. |
Passport |
Значение PassportAuthentication , содержащее URL-адрес, на который будет перенаправляться запрос на проверку подлинности. |
Path |
(Наследуется от ConfigurationSection .) Свойство ключа. |
SectionInformation |
(Является наследником ConfigurationSection ) |
используются подклассы ;
Этот класс не содержит подклассов.
Комментарии
В следующей таблице перечислены возможные Mode
значения для свойства . Значение по умолчанию — 1 (Windows
).
Значение | Ключевое слово | Описание |
---|---|---|
0 | None |
Не указывает проверку подлинности. |
1 | Windows |
Задает в качестве режима проверки подлинности проверку подлинности Windows. Этот режим применяется, если ASP.NET использует методы проверки подлинности Basic, Digest, Integrated Windows (NTLM/Kerberos) или Client Certificate Mapping. |
2 | Passport |
Указывает проверку подлинности Microsoft Passport Network в качестве режима проверки подлинности. |
3 | Forms |
Указывает ASP.NET проверку подлинности с помощью форм в качестве режима проверки подлинности. |
Пример
В следующем примере показан режим проверки подлинности для веб-сайта по умолчанию. Если используется Passport
режим проверки подлинности , отображается URL-адрес перенаправления. Если используется режим , отображаются Forms
соответствующие сведения.
' Connect to the WMI WebAdministration namespace.
Set oWebAdmin = _
GetObject("winmgmts:root\WebAdministration")
' Get the authentication section.
Set oSite = oWebAdmin.Get("Site.Name='Default Web Site'")
oSite.GetSection "AuthenticationSection", oAuthSection
' Display the path and location.
WScript.Echo "Path: " & oAuthSection.Path
WScript.Echo "Location: " & oAuthSection.Location
WScript.Echo
' Get the authentication mode and display it in text.
strAuthMode = ModeText(oAuthSection.Mode)
WScript.Echo "Authentication Mode: " & _
"[ " & strAuthMode & " ]"
' If the mode is Passport or Forms, display the
' additional information.
If strAuthMode = "Passport" Then
WScript.Echo "Passport URL: " & "[" & _
oAuthSection.Passport.RedirectUrl & "]"
ElseIf strAuthMode = "Forms" then
DisplayFormsAuthSettings(oAuthSection.Forms)
End If
' Convert the Mode enumeration values to text.
Function ModeText(enumValue)
Select Case enumValue
Case 0
ModeText = "None"
Case 1
ModeText = "Windows"
Case 2
ModeText = "Passport"
Case 3
ModeText = "Forms"
Case Else
ModeText = "Undefined enumeration value."
End Select
End Function
' Display the Forms authentication settings.
Sub DisplayFormsAuthSettings(oFormsAuthConfig)
WScript.Echo vbCrLf & "Forms Authentication Settings"
WScript.Echo "-----------------------------"
WScript.Echo "Cookieless: [ " & _
CookielessText(oFormsAuthConfig.Cookieless) & " ]"
WScript.Echo "Default Url: [ " & _
oFormsAuthConfig.DefaultUrl & " ]"
WScript.Echo "Domain: [ " & _
oFormsAuthConfig.Domain & " ]"
WScript.Echo "EnableCrossAppRedirects: [" & _
oFormsAuthConfig.EnableCrossAppRedirects & " ]"
WScript.Echo "LoginUrl: [ " & _
oFormsAuthConfig.LoginUrl & " ]"
WScript.Echo "Name: [ " & _
oFormsAuthConfig.Name & " ]"
WScript.Echo "Path: [ " & _
oFormsAuthConfig.Path & " ]"
WScript.Echo "Protection: [ " & _
ProtectionText(oFormsAuthConfig.Protection) & " ]"
WScript.Echo "RequireSSL: [ " & _
oFormsAuthConfig.RequireSSL & " ]"
WScript.Echo "SlidingExpiration: [ " & _
oFormsAuthConfig.SlidingExpiration & " ]"
WScript.Echo "Timeout: [ " & _
oFormsAuthConfig.Timeout & " ]"
DisplayCredentials(oFormsAuthConfig.Credentials)
End Sub
' Convert the Cookieless enumeration values to text.
Function CookielessText(enumValue)
Select Case enumValue
Case 0
CookielessText = "UseUri"
Case 1
CookielessText = "UseCookies"
Case 2
CookielessText = "AutoDetect"
Case 3
CookielessText = "UseDeviceProfile"
Case Else
CookielessText = "Undefined enumeration value."
End Select
End Function
' Convert the Protection enumeration values to text.
Function ProtectionText(enumValue)
Select Case enumValue
Case 0
ProtectionText = "All"
Case 1
ProtectionText = "None"
Case 2
ProtectionText = "Encryption"
Case 3
ProtectionText = "Validation"
Case Else
ProtectionText = "Undefined enumeration value."
End Select
End Function
' Display the Forms authentication credentials.
Sub DisplayCredentials(FA_Credentials)
WScript.Echo vbCrLf & "Forms Authentication Credentials"
WScript.Echo "--------------------------------"
WScript.Echo "Password Format: " & _
PwdFormatText(FA_Credentials.PasswordFormat) & VbCrLf
For Each FormsAuthUser In FA_Credentials.Credentials
WScript.Echo " Name: [ " & FormsAuthUser.Name & " ]"
WScript.Echo "Password: [ " & _
FormsAuthUser.Password& " ]"
WScript.Echo
Next
End Sub
' Convert the PasswordFormat enumeration values to text.
Function PwdFormatText(enumValue)
Select Case enumValue
Case 0
PwdFormatText = "Clear"
Case 1
PwdFormatText = "SHA1"
Case 2
PwdFormatText = "MD5"
Case Else
PwdFormatText = "Undefined enumeration value."
End Select
End Function
Иерархия наследования
ConfigurationSectionWithCollection
AuthenticationSection
Требования
Тип | Описание |
---|---|
клиент | — IIS 7.0 в Windows Vista — IIS 7.5 в Windows 7 — IIS 8.0 в Windows 8 — IIS 10.0 в Windows 10 |
Сервер | — IIS 7.0 в Windows Server 2008 — IIS 7.5 в Windows Server 2008 R2 — IIS 8.0 в Windows Server 2012 — IIS 8.5 в Windows Server 2012 R2 — IIS 10.0 в Windows Server 2016 |
Продукт | — IIS 7.0, IIS 7.5, IIS 8.0, IIS 8.5, IIS 10.0 |
MOF-файл | WebAdministration.mof |
См. также:
Класс AnonymousAuthenticationSection
Класс BasicAuthenticationSection
Класс ClientCertificateMappingAuthenticationSection
Класс ConfigurationSectionWithCollection
Класс DigestAuthenticationSection
Класс FormsAuthenticationConfiguration
Класс FormsAuthenticationCredentials
Класс FormsAuthenticationUser
Класс IisClientCertificateMappingAuthenticationSection
Класс PassportAuthentication
Класс WindowsAuthenticationSection