This documentation is archived and is not being maintained.

ScriptResourceHandler Class

Provides an HTTP handler for processing requests for script files that are embedded as resources in an assembly. This class cannot be inherited.


Namespace:  System.Web.Handlers
Assembly:  System.Web.Extensions (in System.Web.Extensions.dll)

public class ScriptResourceHandler : IHttpHandler

The ScriptResourceHandler type exposes the following members.

Public methodScriptResourceHandlerInitializes a new instance of the ScriptResourceHandler class.

Protected propertyIsReusableWhen overridden in a derived class, gets a value that indicates whether another request can use the instance of the class.

Public methodEquals(Object)Determines whether the specified Object is equal to the current Object. (Inherited from Object.)
Protected methodFinalizeAllows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.)
Public methodGetHashCodeServes as a hash function for a particular type. (Inherited from Object.)
Public methodGetTypeGets the Type of the current instance. (Inherited from Object.)
Protected methodMemberwiseCloneCreates a shallow copy of the current Object. (Inherited from Object.)
Protected methodProcessRequestWhen overridden in a derived class, processes HTTP Web requests for a script file that is embedded as a resource in an assembly.
Public methodToStringReturns a string that represents the current object. (Inherited from Object.)

Explicit interface implemetationPrivate propertyIHttpHandler.IsReusableGets a value that indicates whether another request can use the IHttpHandler instance.
Explicit interface implemetationPrivate methodIHttpHandler.ProcessRequestProcesses HTTP Web requests for a script file that is embedded as a resource in an assembly.

The ScriptResourceHandler class processes all requests for embedded script files that are referenced through the ScriptManager class. The ScriptResourceHandler object retrieves the embedded script library and any localized resources for the script library. If 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.

By default, the ScriptResourceHandler class compresses and caches embedded script files for Internet Explorer 7. You can turn compression and caching off through the EnableCompression and EnableCaching properties of the ScriptingScriptResourceHandlerSection class. You set these properties in the Web.config file.


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. 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.

The default Web.config file for AJAX-enabled ASP.NET Web applications adds the ScriptResourceHandler as a handler. You can manually add the handler to your application by including the following element in the Web.config file:

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

.NET Framework

Supported in: 4, 3.5

Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.