AJAX enabling web client solutions

Topics: Web Client Software Factory, Project Management Forum, User Forum
Feb 15, 2007 at 11:41 AM
Hi, I'm trying to add ASP.NET Ajax features into an existing web client solution generated by the PnP web client software factory guidance package. After installing the necessary pre-reqs and after manipulating the web config file as described in:

http://www.asp.net/learn/videos/view.aspx?tabid=63&id=81

I try to add an ajax 'ScriptManager' control as in '<asp:ScriptManager id="ScriptManager1" runat="server">' in one of the aspx views generated using the software factory: but I'm getting errors abt the ScriptManager element not being a known element. I am able to do this correctly in a .NET website that is not generated using the web client software factory. Is the process involved in adding ASP.NET ajax features to an aspx file in an existing (i.e. not ajax enabled) ASP.NET website any different to one in a solution generated by the web client software factory? can anyone help with adding this functionality correctly to the web client solution.

Thanx
Feb 15, 2007 at 3:21 PM
Hi, just add the config elements below to enable Ajax. I am working without problems with these settings.

<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="false" allowDefinition="MachineToApplication"/>
        <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="false" allowDefinition="Everywhere" />
          <section name="profileService" type="System.Web.Configuration.ScriptingProfileServiceSection, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="false" allowDefinition="MachineToApplication" />
          <section name="authenticationService" type="System.Web.Configuration.ScriptingAuthenticationServiceSection, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="false" allowDefinition="MachineToApplication" />
        </sectionGroup>
      </sectionGroup>
    </sectionGroup>
</configSections>

<system.web>
    <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"/>
      <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>
</system.web>

    <pages>
      <controls>
        <add tagPrefix="asp" namespace="System.Web.UI" assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
      </controls>
    </pages>

  <system.webServer>
    <validation validateIntegratedModeConfiguration="false"/>
    <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-Integrated" />
      <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="ScriptHandlerFactoryAppServices" verb="*" path="*_AppService.axd" preCondition="integratedMode"
           type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
      <add name="ScriptResource" preCondition="integratedMode" verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
    </handlers>
  </system.webServer>

Note that Ajax v1.0 must be installed.
Coordinator
Feb 15, 2007 at 5:24 PM
It is good to hear that you guys are building on the WCSF. There is nothing intrensic in the WCSF design and architecure to preclude using AJAX controls, assumming you have the tools installed and add all the right DLL references, http modules, and handlers.
Feb 16, 2007 at 7:00 PM
I just want to confirm that you can add ASP.NET AJAX to a Web Client Software Factory Application quite easily.

It is really a four step process:

1) Download and install the ASP.NET AJAX Extensions

2) Create an ASP.NET AJAX Enabled Website so you can get a Web.config file filled with AJAX Stuff.

3) Copy and Paste the missing ASP.NET AJAX Web.config data to your existing Web Client Software Factory Web.config.

4) Toss a Script Manager and UpdatePanel on each page in your WCSF application that you want to AJAX enable.

I used Joe Stagner's video that you mentioned above as my initial guide and it all works fine.

I just blogged about it:

Web Client Software Factory and ASP.NET AJAX - Marriage Made in Heaven :)

Regards,

Dave

________________________

David Hayden
Microsoft MVP C#
Coordinator
Feb 19, 2007 at 10:26 PM
David, that is great to hear.
Thanks.
Apr 18, 2007 at 9:30 PM
I tried this. when i paste the following code in web.config of WCSF Solution. it displays an error. the page cannot be debuuged

<pages>
<controls>
<add tagPrefix="asp" namespace="System.Web.UI" assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
</controls>
</pages>

please help me