Monday, May 17, 2010

Configure AJAX in SharePoint (MOSS 2007)

This post presents the configuration changes we need to make in web application's web.config file to extend the application to support AJAX using .NET Framework 3.5. Variout steps are defined in the following XML. Make sure to include all these configurations with atmost accuracy.

NOTE: AJAX is preconfigured in SharePoint 2010 Foundation/Server. No need to configure in these environments in MOSS 2007.

<configuration>
<configsections>
<sectionGroup name="system.web.extensions" type="System.Web.Configuration.SystemWebExtensionsSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">
<sectionGroup name="scripting" type="System.Web.Configuration.ScriptingSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">
<section allowDefinition="MachineToApplication" name="scriptResourceHandler" requirePermission="false" type="System.Web.Configuration.ScriptingScriptResourceHandlerSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
<sectionGroup name="webServices" type="System.Web.Configuration.ScriptingWebServicesSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">
<section allowDefinition="Everywhere" name="jsonSerialization" requirePermission="false" type="System.Web.Configuration.ScriptingJsonSerializationSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
<section allowDefinition="MachineToApplication" name="profileService" requirePermission="false" type="System.Web.Configuration.ScriptingProfileServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
<section allowDefinition="MachineToApplication" name="authenticationService" requirePermission="false" type="System.Web.Configuration.ScriptingAuthenticationServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
</sectionGroup>
</sectionGroup>
</sectionGroup>
</configsections>
</configuration> 


<system.web>
<httpHandlers>
<add path="*.asmx" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" validate="false" verb="*"/>
<add path="*_AppService.axd" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" validate="false" verb="*"/>
<add path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" validate="false" verb="GET,HEAD"/>
</httpHandlers>

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

<compilation>
<assemblies>
<add assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
</assemblies>
</compilation>

<pages>

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

</pages>

</system.web>


<SharePoint>
<SafeControls>

<SafeControl assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" namespace="System.Web.UI" safe="True" typename="*"/>

</SafeControls>
</SharePoint>


<system.webServer>
<validation validateintegratedmodeconfiguration="false">
<modules>
<add name="ScriptModule" precondition="integratedMode" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">
</add></modules>
<handlers>
<remove name="WebServiceHandlerFactory-Integrated">
</remove>
<add name="ScriptHandlerFactory" path="*.asmx" precondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" verb="*"/>
<add name="ScriptHandlerFactoryAppServices" path="*_AppService.axd" precondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" verb="*"/>
<add name="ScriptResource" path="ScriptResource.axd" precondition="integratedMode" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" verb="GET,HEAD" />
</handlers>
</validation>
</system.webServer>


Technorati Tags: ,,,

1 comment:

  1. You means for MOSS2007 right.. SP2010 support this OOTB

    ReplyDelete