ScriptResourceHandler ScriptResourceHandler ScriptResourceHandler ScriptResourceHandler Class

定義

提供處理指令碼檔案要求的 HTTP 處理常式,這些檔案內嵌為組件的資源。Provides an HTTP handler for processing requests for script files that are embedded as resources in an assembly. 這個類別無法被繼承。This class cannot be inherited.

public ref class ScriptResourceHandler : System::Web::IHttpHandler
public class ScriptResourceHandler : System.Web.IHttpHandler
type ScriptResourceHandler = class
    interface IHttpHandler
Public Class ScriptResourceHandler
Implements IHttpHandler
繼承
ScriptResourceHandlerScriptResourceHandlerScriptResourceHandlerScriptResourceHandler
實作

備註

ScriptResourceHandler類別處理所有要求會透過參考的內嵌指令碼檔案ScriptManager類別。The ScriptResourceHandler class processes all requests for embedded script files that are referenced through the ScriptManager class. ScriptResourceHandler物件擷取的內嵌指令碼程式庫和任何當地語系化的資源指令碼程式庫。The ScriptResourceHandler object retrieves the embedded script library and any localized resources for the script library. 如果NotifyScriptLoaded屬性設定為true,則ScriptResourceHandler物件的指令碼檔案結尾處新增呼叫至物件的方法。If the NotifyScriptLoaded property is set to true, the ScriptResourceHandler object adds a call at the end of the script file to the method of the object.

根據預設,ScriptResourceHandler類別會壓縮,並會快取 Internet Explorer 7 的 內嵌指令碼檔案。By default, the ScriptResourceHandler class compresses and caches embedded script files for Internet Explorer 7. 您可以開啟壓縮和快取關閉EnableCompressionEnableCaching的屬性ScriptingScriptResourceHandlerSection類別。You can turn compression and caching off through the EnableCompression and EnableCaching properties of the ScriptingScriptResourceHandlerSection class. 您的 Web.config 檔案中設定這些屬性。You set these properties in the Web.config file.

注意

您可以開啟壓縮對於舊版的 Internet Explorer 建立 Web.config 檔的區段中的 Internet Explorer 7 的別名。You can turn compression on for earlier versions of Internet Explorer by creating an alias for Internet Explorer 7 in the section of the Web.config file. 您接著以程式設計方式設定的值ClientTarget該別名的屬性。You then programmatically set the value of the ClientTarget property to that alias. 不過,我們不建議這種方法,因為它會導致效能降低,並提供錯誤高風險。However, we do not recommend this approach because it will cause a decrease in performance and it introduces a high risk of errors.

啟用 AJAX 的 ASP.NET Web 應用程式的預設 Web.config 檔案將加入ScriptResourceHandler做為處理常式。The default Web.config file for AJAX-enabled ASP.NET Web applications adds the ScriptResourceHandler as a handler. 您可以手動將處理常式加入您的應用程式 Web.config 檔案中包含下列項目:You can manually add the handler to your application by including the following element in the Web.config file:

<httpHandlers>  
  <add verb="GET,HEAD" path="ScriptResource.axd"   
    type="System.Web.Handlers.ScriptResourceHandler,   
    System.Web.Extensions, Version=1.0.61025.0, Culture=neutral,   
    PublicKeyToken=31bf3856ad364e35" validate="false" />  
</httpHandlers>  

建構函式

ScriptResourceHandler() ScriptResourceHandler() ScriptResourceHandler() ScriptResourceHandler()

初始化 ScriptResourceHandler 類別的新執行個體。Initializes a new instance of the ScriptResourceHandler class.

屬性

IsReusable IsReusable IsReusable IsReusable

在衍生類別中進行覆寫時,會取得一個值,指出另一個要求能否使用類別的執行個體。When overridden in a derived class, gets a value that indicates whether another request can use the instance of the class.

方法

Equals(Object) Equals(Object) Equals(Object) Equals(Object)

判斷指定的物件是否等於目前的物件。Determines whether the specified object is equal to the current object.

(Inherited from Object)
GetHashCode() GetHashCode() GetHashCode() GetHashCode()

做為預設雜湊函式。Serves as the default hash function.

(Inherited from Object)
GetType() GetType() GetType() GetType()

取得目前執行個體的 TypeGets the Type of the current instance.

(Inherited from Object)
MemberwiseClone() MemberwiseClone() MemberwiseClone() MemberwiseClone()

建立目前 Object 的淺層複本 (Shallow Copy)。Creates a shallow copy of the current Object.

(Inherited from Object)
ProcessRequest(HttpContext) ProcessRequest(HttpContext) ProcessRequest(HttpContext) ProcessRequest(HttpContext)

在衍生類別中進行覆寫時,處理對內嵌在組件中做為資源之指令碼檔的 HTTP Web 要求。When overridden in a derived class, processes HTTP Web requests for a script file that is embedded as a resource in an assembly.

ToString() ToString() ToString() ToString()

傳回代表目前物件的字串。Returns a string that represents the current object.

(Inherited from Object)

明確介面實作

IHttpHandler.IsReusable IHttpHandler.IsReusable IHttpHandler.IsReusable IHttpHandler.IsReusable

取得值,指出另一個要求是否可以使用 IHttpHandler 執行個體。Gets a value that indicates whether another request can use the IHttpHandler instance.

IHttpHandler.ProcessRequest(HttpContext) IHttpHandler.ProcessRequest(HttpContext) IHttpHandler.ProcessRequest(HttpContext) IHttpHandler.ProcessRequest(HttpContext)

處理對內嵌在組件中做為資源之指令碼檔的 HTTP Web 要求。Processes HTTP Web requests for a script file that is embedded as a resource in an assembly.

安全性

AspNetHostingPermission
用於裝載環境中的作業。for operating in a hosted environment. 要求值: InheritanceDemandDemand value: InheritanceDemand. 權限的值: MinimalPermission value: Minimal

適用於