ASPxHttpHandlerModule

  • 5 minutes to read

ASP.NET's built-in HTTP Handler and Module generates one HTTP request per file and loads these files sequentially when a browser loads a web page. If a web page contains many files (such as scripts, styles, binary data, etc.), load time may increase.

The DevExpress ASP.NET Subscription includes ASPxHttpHandlerModule (the DevExpress HTTP Handler and Module). This handler/module is implemented instead of the standard HTTP resource handler and increases web page loading speed.

The ASPxHttpHandlerModule can function as both a handler and a module.

ASPxHttpHandlerModule Registration

Register the ASPxHttpHandlerModule by automatically or manually adding configuration strings to the following Web.Config file sections:

Automatic registration

You can automatically register the ASPxHttpHandlerModule as a module and a handler by adding the required strings to the sections described above in the following cases:

Manual registration

You can add the following strings to the Web.Config file if the ASPxHttpHandlerModule is not registered automatically:

For v14.2 and Later

IIS (classic mode)

<system.web>
     ...
    <httpHandlers>
      <add type="DevExpress.Web.ASPxHttpHandlerModule, DevExpress.Web.v20.2, Version=20.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" verb="GET"
      path="DX.ashx" validate="false" />
    </httpHandlers>
    <httpModules>
      <add type="DevExpress.Web.ASPxHttpHandlerModule, DevExpress.Web.v20.2, Version=20.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" name="ASPxHttpHandlerModule"/>
    </httpModules>
    ...
</system.web>

IIS7 and newer (integrated mode)

<system.web>
    ...
    <httpHandlers>
      <add type="DevExpress.Web.ASPxHttpHandlerModule, DevExpress.Web.v20.2, Version=20.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" verb="GET"
      path="DX.ashx" validate="false" />
    </httpHandlers>
    <httpModules>
      <add type="DevExpress.Web.ASPxHttpHandlerModule, DevExpress.Web.v20.2, Version=20.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" name="ASPxHttpHandlerModule"/>
    </httpModules>
    ...
</system.web>

<system.webServer>
     ...
    <validation validateIntegratedModeConfiguration="false" />
    <handlers>
      <add type="DevExpress.Web.ASPxHttpHandlerModule, DevExpress.Web.v20.2, Version=20.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" verb="GET" name="ASPxHttpHandlerModule"
      path="DX.ashx" preCondition="integratedMode" />
    </handlers>
    <modules>
      <add type="DevExpress.Web.ASPxHttpHandlerModule, DevExpress.Web.v20.2, Version=20.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" name="ASPxHttpHandlerModule"/>
    </modules>
    ...
</system.webServer>

Note that you should specify the PublicKeyToken (PublicKeyToken=b88d1754d700e49a" in the example), assembly version (Version=20.2.3.0), and assembly name (DevExpress.Web.v20.2) in these strings.

For v14.1 and Older

IIS (classic mode)

<system.web>
    ...
    <httpHandlers>
      <add type="DevExpress.Web.ASPxClasses.ASPxHttpHandlerModule, DevExpress.Web.v14.1, Version=14.1.8.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" verb="GET"
      path="DX.ashx" validate="false" />
    </httpHandlers>
    <httpModules>
      <add type="DevExpress.Web.ASPxClasses.ASPxHttpHandlerModule, DevExpress.Web.v14.1, Version=14.1.8.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" name="ASPxHttpHandlerModule"/>
    </httpModules>
    ...
</system.web>

IIS7 and newer (integrated mode)

<system.web>
    ...
    <httpHandlers>
      <add type="DevExpress.Web.ASPxClasses.ASPxHttpHandlerModule, DevExpress.Web.v14.1, Version=14.1.8.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" verb="GET"
      path="DX.ashx" validate="false" />
    </httpHandlers>
    <httpModules>
      <add type="DevExpress.Web.ASPxClasses.ASPxHttpHandlerModule, DevExpress.Web.v14.1, Version=14.1.8.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" name="ASPxHttpHandlerModule"/>
    </httpModules>
    ...
</system.web>

<system.webServer>
    ...
    <validation validateIntegratedModeConfiguration="false" />
    <handlers>
      <add type="DevExpress.Web.ASPxClasses.ASPxHttpHandlerModule, DevExpress.Web.v14.1, Version=14.1.8.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" verb="GET" name="ASPxHttpHandlerModule"
      path="DX.ashx" preCondition="integratedMode" />
    </handlers>
    <modules>
      <add type="DevExpress.Web.ASPxClasses.ASPxHttpHandlerModule, DevExpress.Web.v14.1, Version=14.1.8.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" name="ASPxHttpHandlerModule"/>
    </modules>
    ...
</system.webServer>

Note that you need to specify the PublicKeyToken (PublicKeyToken=b88d1754d700e49a" in the example), assembly version (Version=14.1.8.0), and assembly name (DevExpress.Web.v14.1) in these strings.

TIP

If you use reporting controls in your ASP.NET application, you may also need to register HTTP handlers for these controls. See the following help topic for more information: Registering ASPxHttpHandlerModule for Reporting Controls.

ASPxHttpHandlerModule as a Module

The ASPxHttpHandlerModule is subscribed to an application's PreSendRequestHeaders and AuthenticateRequest events, so it has access to ASP.NET application life cycle events, and can assess incoming requests and modify outbound responses.

The primary ASPxHttpHandlerModule features are listed below.

NOTE

You can manipulate specific DevExpress options within the Web.Config file to affect how ASPxHttpHandlerModule forms respond. Refer to the following help topic to learn more: Web.Config Options Overview.

ASPxHttpHandlerModule as a Handler

The optional ASPxHttpHandlerModule handler functionality allows you to merge and compress custom CSS and JavaScript source files. See the following help topic for more details: How to: Merge and Compress Custom CSS and JavaScript Files.

NOTE

To enable file compression, the enableResourceCompression option must be set to true (the default value).

WebResourceAssembly Attribute

When you create a custom assembly that contains DevExpress resources, set the WebResourceAssembly(assemblyID) attribute to specify that the assembly can export resources via the ASPxHttpHandlerModule. Note that the WebResourceAssembly attribute value should exceed 100. This is required to avoid conflicts with values of this attribute reserved for DevExpress controls.

[assembly: WebResourceAssembly(104)]

To review the complete sample project, refer to the following Support Center Example: How to create a custom theme assembly.

See Also