XmlTextReader.ProhibitDtd 屬性

定義

警告

Use DtdProcessing property instead.

警告

XmlTextReader.ProhibitDtd has been deprecated. Use DtdProcessing instead.

取得或設定值,指出是否允許 DTD 處理。 這個屬性已經過時。 請改用 DtdProcessing

public:
 property bool ProhibitDtd { bool get(); void set(bool value); };
[System.Obsolete("Use DtdProcessing property instead.")]
public bool ProhibitDtd { get; set; }
[System.Obsolete("XmlTextReader.ProhibitDtd has been deprecated. Use DtdProcessing instead.")]
public bool ProhibitDtd { get; set; }
public bool ProhibitDtd { get; set; }
[<System.Obsolete("Use DtdProcessing property instead.")>]
member this.ProhibitDtd : bool with get, set
[<System.Obsolete("XmlTextReader.ProhibitDtd has been deprecated. Use DtdProcessing instead.")>]
member this.ProhibitDtd : bool with get, set
member this.ProhibitDtd : bool with get, set
Public Property ProhibitDtd As Boolean

屬性值

true 表示不允許 DTD 處理,否則為 false。 預設為 false

屬性

備註

注意

從 .NET Framework 2.0 開始,建議您使用 XmlReader.Create 方法來建立 XmlReader 實例,以利用新功能。

DTD 處理預設為回溯相容性啟用。 不過,除非您的應用程式需要 DTD 處理,否則您應該停用此設定。 在防止某些阻斷服務攻擊時,停用 DTD 處理會很有用。 如果設定為 true ,則讀取器會在遇到任何 DTD 內容時擲 XmlException 回 。

如果您已啟用 DTD 處理,您必須注意包括來自不受信任來源的 DTD,以及可能的阻斷服務攻擊。 XmlSecureResolver使用 來限制 可以存取的資源 XmlTextReader 。 您還可以設計應用程式,讓 XML 處理具有記憶體和時間限制。 例如,在 ASP.NET 應用程式中設定逾時限制

適用於

另請參閱