Version

Set Up an ASP.NET Web Site to Run ASP.NET AJAX

WebResizingExtender™ is built on the Microsoft® ASP.NET AJAX Extensions, and all controls that depend on this framework rely on a component called the ScriptManager. A ScriptManager component must be the first component on the page in order for dependent controls to work, including WebResizingExtender.

To aid with this dependency Microsoft® has released with the framework a Web site called ASP.NET AJAX CTP-enabled Web site, which already contains this control on the form, and all the settings needed in the Web.config file for it to work. The problem is that most people can’t move all their content over to a new Web Site type. Therefore this topic will guide you through the process of bringing the required modifications into the standard ASP.NET Web site to run the ASP.NET AJAX Extension Framework, thereby taking advantage of WebResizingExtender inside an existing project.

Note
Note:

The following information is based on 1.0 RC of the ASP.NET AJAX Extension Framework. If you are running a later version, you may need to modify the version numbers on the tags to match your version.

  1. Most of the modifications needed occur inside the Web.config file, starting with the following excerpt that should be placed directly inside the opening <configuration> tag.

In XML:

<configSections>
        <sectionGroup name="system.web.extensions"
          type="System.Web.Configuration.SystemWebExtensionsSectionGroup, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">
                <sectionGroup name="scripting"
                  type="System.Web.Configuration.ScriptingSectionGroup, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">
                        <section name="scriptResourceHandler"
                          type="System.Web.Configuration.ScriptingScriptResourceHandlerSection, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="/>
                        <sectionGroup name="webServices"
                          type="System.Web.Configuration.ScriptingWebServicesSectionGroup, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">
                                <section name="jsonSerialization"
                                  type="System.Web.Configuration.ScriptingJsonSerializationSection, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission=" />
                                <section name="profileService"
                                  type="System.Web.Configuration.ScriptingProfileServiceSection, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission=" />
                                <section name="authenticationService"
                                  type="System.Web.Configuration.ScriptingAuthenticationServiceSection, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission=" />
                        </sectionGroup>
                </sectionGroup>
        </sectionGroup>
</configSections>
  1. Place the following XML excerpt between the opening and closing <system.web> tags.

In XML:

<pages>
        <controls>
                <add tagPrefix="asp" namespace="System.Web.UI"
                  assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
                <add tagPrefix="asp" namespace="Microsoft.Web.Preview.UI"
                  assembly="Microsoft.Web.Preview"/>
                <add tagPrefix="asp" namespace="Microsoft.Web.Preview.UI.Controls"
                  assembly="Microsoft.Web.Preview"/>
        </controls>
        <tagMapping>
                <add tagtype="System.Web.UI.WebControls.CompareValidator"
                  mappedTagtype="System.Web.UI.Compatibility.CompareValidator, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
                <add tagtype="System.Web.UI.WebControls.CustomValidator"
                  mappedTagtype="System.Web.UI.Compatibility.CustomValidator, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
                <add tagtype="System.Web.UI.WebControls.RangeValidator"
                  mappedTagtype="System.Web.UI.Compatibility.RangeValidator, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
                <add tagtype="System.Web.UI.WebControls.RegularExpressionValidator"
                  mappedTagtype="System.Web.UI.Compatibility.RegularExpressionValidator, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
                <add tagtype="System.Web.UI.WebControls.RequiredFieldValidator"
                  mappedTagtype="System.Web.UI.Compatibility.RequiredFieldValidator, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
                <add tagtype="System.Web.UI.WebControls.ValidationSummary"
                  mappedTagtype="System.Web.UI.Compatibility.ValidationSummary, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
        </tagMapping>
</pages>
<!-- Set compilation debug="true" to insert debugging symbols into the compiled page. Because this affects performance, set this value to true only during development. -->
<compilation debug=">
        <assemblies>
                <add assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
        </assemblies>
        <buildProviders>
                <add extension="$$*$$.asbx" type="Microsoft.Web.Preview.Services.BridgeBuildProvider"/>
        </buildProviders>
</compilation>
<httpHandlers>
        <remove verb="$$*$$" path="$$* $$.asmx"/>
                <add verb="$$*$$" path="$$* $$.asmx" validate="
                  type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
                <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="/>
                <add verb="GET,HEAD,POST" path="$$*$$.asbx"
                  type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" validate="/>
</httpHandlers>
<httpModules>
        <add name="ScriptModule"
          type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
</httpModules>
  1. Place the following XML excerpt after the closing <system.web> tag, but before the closing <configuration> tag.

In XML:

<system.web.extensions>
        <scripting>
                <webServices>
<!-- Uncomment this line to customize maxJsonLength and add a custom converter -->
                <!--
                <jsonSerialization maxJsonLength="500">
                        <converters>
                                <add name="DataSetConverter"
                                  type="Microsoft.Web.Preview.Script.Serialization.Converters.DataSetConverter, Microsoft.Web.Preview, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
                                <add name="DataRowConverter"
                                  type="Microsoft.Web.Preview.Script.Serialization.Converters.DataRowConverter, Microsoft.Web.Preview, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
                                <add name="DataTableConverter"
                                  type="Microsoft.Web.Preview.Script.Serialization.Converters.DataTableConverter, Microsoft.Web.Preview, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
                        </converters>
                </jsonSerialization>
                -->
                <!-- Uncomment this line to enable the authentication service. Include requireSSL="true" if appropriate. -->
                <!--
                <authenticationService enabled="true" requireSSL = "true|/>
                -->
                <!-- Uncomment these lines to enable the profile service. To allow profile properties to be retrieved
                  and modified in ASP.NET AJAX applications, you need to add each property name to the readAccessProperties and
                  writeAccessProperties attributes. -->
                <!--
                <profileService enabled="true"
                  readAccessProperties="propertyname1,propertyname2"
                  writeAccessProperties="propertyname1,propertyname2" />
                -->
                </webServices>
<!--
                <scriptResourceHandler enableCompression="true" enableCaching="true" />
                -->
        </scripting>
</system.web.extensions>
  1. The final Web.config modification is to place the following XML excerpt below the <system.web.extensions> closing tag, but again before the closing <configuration> tag.

In XML:

<system.webServer>
        <validation validateIntegratedModeConfiguration="/>
        <modules>
                <add name="ScriptModule" preCondition="integratedMode"
                  type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
        </modules>
        <handlers>
                <remove name="WebServiceHandlerFactory-ISAPI-2.0"/>
                <add name="ScriptHandlerFactory" verb="*" path="* .asmx" preCondition="integratedMode"
                  type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
                <add name="ScriptResource" verb="GET" path="ScriptResource.axd"
                  type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
                <add name="ASBXHandler" verb="GET,HEAD,POST" path="*.asbx" preCondition="integratedMode"
                  type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
        </handlers>
</system.webServer>
  1. Add the Microsoft.Web.Preview.dll to the Bin folder of your project because this assembly isn’t in the Global Assembly Cache so it needs to be local to the project.

  2. Add the <ScriptManager> tag to your ASPX page as shown in the example code below.

In XML:

<form id="form1" runat="server">
    <asp:ScriptManager id="ScriptManager1" runat="server" />
    <div>
    </div>
</form>
Note
Note:

The ScriptManager tag needs to be placed directly inside the <form> tag, and before any other tag on the form in order for it to work properly.