.NET Framework Class Library
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)
Syntax

Visual Basic (Declaration)
<AspNetHostingPermissionAttribute(SecurityAction.LinkDemand, Level := AspNetHostingPermissionLevel.Minimal)> _
<AspNetHostingPermissionAttribute(SecurityAction.InheritanceDemand, Level := AspNetHostingPermissionLevel.Minimal)> _
Public Class ScriptResourceHandler _
    Implements IHttpHandler
Visual Basic (Usage)
Dim instance As ScriptResourceHandler
C#
[AspNetHostingPermissionAttribute(SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
[AspNetHostingPermissionAttribute(SecurityAction.InheritanceDemand, Level = AspNetHostingPermissionLevel.Minimal)]
public class ScriptResourceHandler : IHttpHandler
Visual C++
[AspNetHostingPermissionAttribute(SecurityAction::LinkDemand, Level = AspNetHostingPermissionLevel::Minimal)]
[AspNetHostingPermissionAttribute(SecurityAction::InheritanceDemand, Level = AspNetHostingPermissionLevel::Minimal)]
public ref class ScriptResourceHandler : IHttpHandler
JScript
public class ScriptResourceHandler implements IHttpHandler
Remarks

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.

NoteNote:

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.

NoteNote:

When an ASP.NET page that contains AJAX functionality runs on IIS 7.0 on Windows Vista , and if the managed pipeline mode of IIS 7.0 is set to Integrated, the scripts processed by the ScriptResourceHandler class are not cached. The scripts are cached when the managed pipeline mode is set to Classic. For more information about the managed pipeline mode of IIS 7.0, see Upgrading ASP.NET Applications to IIS 7.0: Differences between IIS 7.0 Integrated Mode and Classic Mode.

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:

<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>
.NET Framework Security

Inheritance Hierarchy

System..::.Object
  System.Web.Handlers..::.ScriptResourceHandler
Thread Safety

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

Windows 7, Windows Vista, Windows XP SP2, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003

The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.
Version Information

.NET Framework

Supported in: 3.5
See Also

Reference

Tags :


Page view tracker