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
實作

備註

類別會處理ScriptManager透過類別參考之內嵌腳本檔案的所有要求。 ScriptResourceHandlerThe 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. true ScriptResourceHandler如果屬性設定為, 物件會在腳本檔案結尾處, 將呼叫新增至sys.databases物件的 sys.application.notifyscriptloaded 方法。 NotifyScriptLoadedIf the NotifyScriptLoaded property is set to true, the ScriptResourceHandler object adds a call at the end of the script file to the notifyScriptLoaded method of the Sys.Application object.

根據預設, ScriptResourceHandler類別會壓縮和快取 Internet Explorer 7 的內嵌腳本檔案。By default, the ScriptResourceHandler class compresses and caches embedded script files for Internet Explorer 7. 您可以透過EnableCompression ScriptingScriptResourceHandlerSection類別的和EnableCaching屬性來關閉壓縮和快取。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.

注意

您可以在 web.config 檔案的clientTarget區段中建立 internet explorer 7 的別名, 針對舊版的 internet explorer 開啟壓縮功能。You can turn compression on for earlier versions of Internet Explorer by creating an alias for Internet Explorer 7 in the clientTarget 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

適用於