共用方式為


RequestFilteringSection 類別

設定內送 URL 要求的掃描。

Syntax

class RequestFilteringSection : ConfigurationSectionWithCollection  

方法

下表列出 類別所 RequestFilteringSection 公開的方法。

名稱 描述
加入 (繼承自 ConfigurationSectionWithCollection.)
清除 (繼承自 ConfigurationSectionWithCollection。)
Get (繼承自 ConfigurationSectionWithCollection。)
GetAllowDefinition (繼承自 ConfigurationSection.)
GetAllowLocation (繼承自 ConfigurationSection。)
移除 (繼承自 ConfigurationSectionWithCollection。)
RevertToParent (繼承自 ConfigurationSection。)
SetAllowDefinition (繼承自 ConfigurationSection。)
SetAllowLocation (繼承自 ConfigurationSection。)

屬性

下表列出 類別所 RequestFilteringSection 公開的屬性。

名稱 描述
AllowDoubleEscaping 讀取/寫入 boolean 值。 true 如果 URL 中允許雙逸出字元,則為 ;否則為 false 。 預設值為 false
AllowHighBitCharacters 讀取/寫入 boolean 值。 true 如果 URL 中允許非 ASCII 字元,則為 ;否則為 false 。 預設值為 true
DenyUrlSequences UrlSequenceSettings值,其中包含可用來攻擊網頁伺服器的 URL 序列,因此將會遭到拒絕。
FileExtensions 可讀寫 的 FileExtensionsSettings 值,指定可在要求中允許或拒絕的副檔名。
HiddenSegments HiddenSegmentSettings值,指定內容不會提供給用戶端的區段。 注意: 區段是兩個斜線之間 URL 的一部分,或最後一個斜線後面的 URL 部分。 例如,URL /segment1/segment2/segment3.asp 有三個區段:segment1、segment2 和 segment3.asp。 注意: 預設會封鎖下列區段:bin、App_code、App_GlobalResources、App_LocalResources、App_WebReferences、App_Data和App_Browsers。
Location (繼承自 ConfigurationSection .) 金鑰屬性。
Path (繼承自 ConfigurationSection .) 金鑰屬性。
RequestLimits RequestLimitsElement值,指定傳入 HTTP 要求的大小限制。
SectionInformation (繼承自 ConfigurationSection。)
Verbs 可讀寫 的 VerbsSettings 值,指定要允許或拒絕的 HTTP 動詞。 注意: 不支援 HTTP 動詞命令的萬用字元。

子類別

這個類別不包含子類別。

備註

這個類別會整合至 IIS 7 舊版 IIS 所使用的 URLScan 工具功能。

注意

若要讓 類別中的 RequestFilteringSection 功能運作,必須安裝要求篩選模組 (Modrqflt.dll) 。

範例

下列範例顯示ApplicationHost.config檔案中要求篩選區段的所有屬性。

' Connect to the WMI WebAdministration namespace.  
Set objWMIService = GetObject("winmgmts:root\WebAdministration")  
  
' Get the request-filtering section.  
Set oRequestFilteringSection = objWMIService.Get( _  
"RequestFilteringSection.Path='MACHINE/WEBROOT/APPHOST',Location=''")  
  
' Show the path.  
WScript.Echo "[Request Filtering Path]"  
WScript.Echo oRequestFilteringSection.Path_  
WScript.Echo   
  
' Show the AllowDoubleEscaping property as "True" or "False."  
WScript.Echo "[AllowDoubleEscaping]"  
WScript.Echo CStr(oRequestFilteringSection.AllowDoubleEscaping)  
WScript.Echo   
  
' Show the AllowHighBitCharacters property as "True" or "False."  
WScript.Echo "[AllowHighBitCharacters]"  
WScript.Echo CStr(oRequestFilteringSection.AllowHighBitCharacters)  
WScript.Echo   
  
' List the denied URL sequences.  
WScript.Echo "[Denied Url Sequences]"  
For Each oSequence In _  
    oRequestFilteringSection.DenyUrlSequences.DenyUrlSequences  
    WScript.Echo oSequence.Sequence  
Next  
WScript.Echo   
  
' List the file extensions settings.  
WScript.Echo "[File Extensions]"  
  
' Show the AllowUnlisted property as "True" or "False."  
WScript.Echo "Allow unlisted file extensions: " & _  
    oRequestFilteringSection.FileExtensions.AllowUnlisted  
WScript.Echo  
  
' List each file extension and show whether it is allowed.  
For Each oFileExtension In _  
    oRequestFilteringSection.FileExtensions.FileExtensions  
    WScript.Echo "File extension: " & oFileExtension.FileExtension  
    WScript.Echo "File extension allowed: " & oFileExtension.Allowed  
    WScript.Echo  
Next  
WScript.Echo   
  
' List the hidden segments.  
WScript.Echo "[Hidden Segments]"  
For Each oHiddenSegment In _  
    oRequestFilteringSection.HiddenSegments.HiddenSegments  
    WScript.Echo oHiddenSegment.Segment  
Next  
WScript.Echo   
  
' Show the request limits settings.  
WScript.Echo "[Request Limits]"  
WScript.Echo "maxAllowedContentLength: " & _  
oRequestFilteringSection.RequestLimits.maxAllowedContentLength  
WScript.Echo "maxUrl: " & oRequestFilteringSection.RequestLimits.maxUrl  
WScript.Echo "maxQueryString: " & oRequestFilteringSection.RequestLimits.maxQueryString  
WScript.Echo   
  
' Show the header limits settings.  
WScript.Echo vbtab & "[Header Limits]"  
For Each oHeaderLimit In _  
    oRequestFilteringSection.RequestLimits.HeaderLimits.HeaderLimits  
    WScript.Echo vbtab & "Header: " & oHeaderLimit.Header  
    WScript.Echo vbtab & "Header size limit: " & oHeaderLimit.SizeLimit  
    WScript.Echo   
Next  
  
' List the verbs settings.  
WScript.Echo "[Verbs]"  
WScript.Echo "Allow unlisted verbs: " & oRequestFilteringSection.Verbs.AllowUnlisted  
WScript.Echo   
  
' List each verb and show whether it is allowed.  
For Each oVerb In oRequestFilteringSection.Verbs.Verbs  
    WScript.Echo "Verb: " & oVerb.Verb  
    WScript.Echo "Verb allowed: " & oVerb.Allowed  
    WScript.Echo  
Next  
  

繼承階層架構

ConfigurationSection

ConfigurationSectionWithCollection

RequestFilteringSection

規格需求

類型 描述
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

另請參閱

ConfigurationSectionWithCollection 類別
FileExtensionElement 類別
FileExtensionsSettings 類別
HeaderLimitsSettings 類別
HiddenSegmentSettings 類別
<requestFiltering>
RequestLimitsElement 類別
UrlSequence 類別
UrlSequenceSettings 類別
VerbElement 類別
VerbsSettings 類別