ScriptHandlerFactory and ScriptModule Classes for JSON Routing

Listing 1. ASP.NET AJAX provides two key classes named ScriptHandlerFactory and ScriptModule that are used to route JSON messages to .NET Web services. These configuration entries are added automatically when you create a new ASP.NET AJAX-Enabled Web site in Visual Studio .NET.

<httpHandlers>
   <remove verb="*" path="*.asmx"/>
   <add verb="*" path="*.asmx" validate="false"
      type="System.Web.Script.Services.ScriptHandlerFactory,
      System.Web.Extensions, Version=1.0.61025.0,
 Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
   <add verb="*" path="*_AppService.axd" validate="false"
      type="System.Web.Script.Services.ScriptHandlerFactory,
      System.Web.Extensions, Version=1.0.61025.0,
      Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
</httpHandlers>

<httpModules>
   <add name="ScriptModule" type="System.Web.Handlers.ScriptModule,
      System.Web.Extensions, Version=1.0.61025.0, Culture=neutral,
      PublicKeyToken=31bf3856ad364e35"/>
</httpModules>