Home > Development, Microsoft Office SharePoint Server 2007 > Create an Ajax Web Part for MOSS2007

Create an Ajax Web Part for MOSS2007


For creating Ajax Web part in MOSS2007, firstly we need to enable Ajax in SharePoint 2007. We need to edit web.config of the web applications of SharePoint 2007 to support AJAX.

We will add multiple sections in web.config file as the following

1-      Add the following entries under  <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 name=”scriptResourceHandler” type=”System.Web.Configuration.ScriptingScriptResourceHandlerSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35″ requirePermission=”false” allowDefinition=”MachineToApplication” /> 

 

<sectionGroup name=”webServices” type=”System.Web.Configuration.ScriptingWebServicesSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35″>

 <section name=”jsonSerialization” type=”System.Web.Configuration.ScriptingJsonSerializationSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35″ requirePermission=”false” allowDefinition=”Everywhere” /> 

 

<section name=”profileService” type=”System.Web.Configuration.ScriptingProfileServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35″ requirePermission=”false” allowDefinition=”MachineToApplication” /> 

 

<section name=”authenticationService” type=”System.Web.Configuration.ScriptingAuthenticationServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35″ requirePermission=”false” allowDefinition=”MachineToApplication” />

 

</sectionGroup>

</sectionGroup>

</sectionGroup

 

2-      Add the following entries under <pages>

<controls>

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

</controls> 

 

 

 

 

3-      add the following entries under <compilation><assemblies>

<add assembly=”System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35″ />

 

4-    add the following entries under <httpHandlers>

<add verb=”*” path=”*.asmx” validate=”false”type=”System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0,Culture=neutral, PublicKeyToken=31bf3856ad364e35″ />     

 

<add verb=”*”path=”*_AppService.axd” validate=”false”type=”System.Web.Script.Services.ScriptHandlerFactory, SSystem.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35″ />     

 

<add verb=”GET,HEAD”path=”ScriptResource.axd”type=”System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35″ validate=”false” />

 

5-    add the following entries under <httpModules>

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

 

6-    at the end of the web.config and before <configuration> add the following:

<system.web.extensions>

    <scripting>     

       <webServices>        <!– Uncomment this line to enable the authentication service. Include requireSSL=”true” if appropriate. –>        <!–        <authenticationService enabled=”true” requireSSL = “true|false”/>      –>        <!– 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> 

<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″/>

</modules>

<handlers> 

<removename=”WebServiceHandlerFactory-Integrated” /> 

 

<addname=”ScriptHandlerFactory” verb=”*” path=”*.asmx”preCondition=”integratedMode”type=”System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35″ />

<addname=”ScriptHandlerFactoryAppServices” verb=”*”path=”*_AppService.axd” preCondition=”integratedMode”type=”System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35″ />

<addname=”ScriptResource” preCondition=”integratedMode”verb=”GET,HEAD” path=”ScriptResource.axd”type=”System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35″ /> 

</handlers> </system.webServer> 

7-    add the following entry under <SafeControls> section

<SafeControl Assembly=”System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35″Namespace=”System.Web.UI” TypeName=”*” Safe=”True” /> 

 

 

 

 

Advertisements
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: