Page.AspCompatMode Page.AspCompatMode Page.AspCompatMode Page.AspCompatMode Property

定義

設定數值,指出頁面是否可以在單一執行緒 Apartment (STA) 執行緒上執行。Sets a value indicating whether the page can be executed on a single-threaded apartment (STA) thread.

protected:
 property bool AspCompatMode { bool get(); void set(bool value); };
protected bool AspCompatMode { get; set; }
member this.AspCompatMode : bool with get, set
Protected Property AspCompatMode As Boolean

屬性值

如果頁面支援 Active Server Pages (ASP) 程式碼,則為 true,否則為 falsetrue if the page supports Active Server Pages (ASP) code; otherwise, false. 預設為 falseThe default is false.

備註

當設定為true,這個屬性可讓頁面以單一執行緒 apartment (STA) 執行緒上執行。When set to true, this property allows the page to be executed on a single-threaded apartment (STA) thread. 這可讓呼叫 STA 元件,例如元件與 Visual Basic 6.0 開發頁面。This allows the page to call STA components, such as components developed with Visual Basic 6.0. 將此屬性設定為true也可讓頁面以呼叫 COM + 元件,需要存取 unmanaged ASP 內建物件。Setting this property to true also allows the page to call COM+ components that require access to the unmanaged ASP built-in objects. 這些都是透過 ASPObjectContext物件或OnStartPage方法。These are accessible through the ASP ObjectContext object or the OnStartPage method.

在大部分情況下,請勿在程式碼中設定這個屬性。In most circumstances, do not set this property in code. 設定aspcompat屬性設定為true使用@ Page .aspx 檔案中的指示詞。Set the aspcompat attribute to true using the @ Page directive in the .aspx file. 當要求網頁時,將屬性設定動態產生的類別。When the page is requested, the dynamically generated class sets the property.

適用於