in

SharePoint Blogs

The Best Place for SharePoint-related Blogs

Tobias Zimmergren's thoughts on development - MOVED!

THIS BLOG HAS MOVED!!!
NEW URL: www.zimmergren.net
Please update your RSS and bookmarks!

Any comments here will not be answered, please comment on http://www.zimmergren.net instead!
All the same posts are there

MOSS 2007: Add support for AJAX in your SharePoint installation

Author: Tobias Zimmergren
Url:
http://www.sharepointblogs.com/zimmer

In this very short and straight-on post I'll just mention how you can configure your SharePoint installation to enable support for ASP.NET AJAX 1.0 since a lot of people have been asking me about it.

Before we make any changes in the web.config we need the following:

  • A backup of the web.config file (important, because if something goes wrong you might need to revert to the old one)
  • SharePoint (WSS 3.0 or MOSS 2007)
  • ASP.NET 2.0 AJAX 1.0 Extensions
  • Be in the mood for some copy/pasting the following 5 minutes

Copy/Paste time

Locate your default web.config file (usually here: "C:\Inetpub\wwwroot\wss\VirtualDirectories\80\web.config").
Edit the webc.config file according to this scenario:

  1. Locate the <configSection> element and add the following code inside it:

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

  2. Within the <system.web> element, locate the <pages> element and insert the following snippet:

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

    EDIT: Thanks to Hardik Bhilota for pointing out that I was missing a comma after the version number. Cheers

  3. Within the <assemblies> element, insert the following snippet:

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

  4. Within the <httpHandlers> element, insert the following snippet:

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

  5. Within the <httpModules> element, add the following snippet:

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

  6. And since we need to ensure that the assembly is trusted, locate the <SafeControls> element ad add the following snippet:

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

  7. Within the <configuration> element, add the following snippet:

    <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=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>

You're all set

Save your web.config file, restart IIS (iisreset.exe for convenience) and enjoy your ASP.NET 2.0 AJAX 1.0 support in SharePoint.
This isn't a big deal to accomplish, so that's all you get from this blogpost.

In the next blogpost I'll talk about how you can easily create a UserControl, hosted with the SmartPart, with support for AJAX.

Comments

 

henry said:

cool it was easy to set up. is it just to add ajax things to teh pages and it works now?

January 4, 2008 10:02 AM
 

SharePoint Link Love: 01-05-2008 at Virtual Generations said:

Pingback from  SharePoint Link Love: 01-05-2008 at  Virtual Generations

January 5, 2008 12:34 PM
 

Roger Lloyd said:

very straight forward, i can now add ajax stuff to my pages aswell. I had missed something in the webconfig file. thanks

January 6, 2008 4:52 AM
 

Links (1/6/2008) « Steve Pietrek’s SharePoint Stuff said:

Pingback from  Links (1/6/2008) &laquo; Steve Pietrek&#8217;s SharePoint Stuff

January 6, 2008 6:51 PM
 

Farid said:

Nice to See that You have started again. I was Worried that You had stopped ;)

Will be Nice to see what You write next, keep en Eye out for my blog soon too

January 7, 2008 2:50 AM
 

SHAREPOINTBlogs.com Mirror said:

Author: Tobias Zimmergren Url: www.sharepointblogs.com/zimmer This post merely shows you how you

January 10, 2008 9:19 AM
 

James Bruiners said:

Hey Im having a problem with this, I think it could be me jsut be very stupid. But Im getting a custome web.config error..

Server Application error....

Line 355:  </system.net>

Line 356:

Line 357:  <system.web.extensions>

Line 358:    <scripting>

Line 359:      <webServices>

any ideas

thanks

Ja

January 11, 2008 4:28 AM
 

Tobias Zimmergren said:

Hey James,

Have you installed the ASP.NET 2.0 AJAX Extensions correctly?

Can you specify a more detailed errormessage, or perhaps see if the event logs say anything?

I havn't been getting any errors at all when I've implemented this on different machines.

January 11, 2008 5:46 AM
 

James said:

Hi,

I have reinstalled ASP.NET 2.0 AJAX Extensions etc... But still same error when loading I get the error bellow:

Ive checked the logs but cant really find anything to meaningful there either.  I get the bizar feeling I am copying pasting incorrectly, but Ive done this now 4 times...

Server Error in '/' Application.

Configuration Error

Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately.

Parser Error Message: Unrecognized configuration section system.web.extensions.

Source Error:

Line 355:  </system.net>

Line 356:

Line 357:  <system.web.extensions>

Line 358:    <scripting>

Line 359:      <webServices>

Source File: C:\Inetpub\wwwroot\wss\VirtualDirectories\80\web.config    Line: 357

--------------------------------------------------------------------------------

Version Information: Microsoft .NET Framework Version:2.0.50727.1433; ASP.NET Version:2.0.50727.1433

January 11, 2008 6:03 AM
 

SharePoint, SharePoint and stuff said:

Novell Userverwaltung mit SharePoint kombinieren Microsoft Office SharePoint Server 2007 and Novell eDirectory

January 11, 2008 8:09 AM
 

Mirrored Blogs said:

Novell Userverwaltung mit SharePoint kombinieren Microsoft Office SharePoint Server 2007 and Novell eDirectory

January 11, 2008 9:05 AM
 

Tobias Zimmergren's thoughts on development said:

Author: Tobias Zimmergren Url: www.sharepointblogs.com/zimmer This post merely shows you how you

January 12, 2008 7:48 AM
 

Tobias Zimmergren's thoughts on development said:

Author: Tobias Zimmergren Url: www.sharepointblogs.com/zimmer If you&#39;ve read my last two blogposts

January 12, 2008 5:10 PM
 

SHAREPOINTBlogs.com Mirror said:

Author: Tobias Zimmergren Url: www.sharepointblogs.com/zimmer If you&#39;ve read my last two blogposts

January 12, 2008 5:27 PM
 

Mattias said:

I get this error message after i try to deploy a control that uses ajax :

System.Security.Permissions.SecurityPermission

any clues on why ?

January 14, 2008 4:33 AM
 

Tobias Zimmergren said:

Mattias: What does your logs say? If you open the logs (located in the "12\LOGS" folder. Surely there's some more information there :)

January 14, 2008 11:01 AM
 

Hardik Bhilota said:

Great article for moving on, but I lost allmost 3 hours just because of following the above mentioned seven stepps blindly.

In step number 2 we have to make the entry for the control snippet in <pages> element. But a coma is missing after version and before culture  in the assembly attribute of <add> element under the <control> element:-

Step 2. Within the <system.web> element, locate the <pages> element and insert the following snippet:

Wrong :-

<controls>

 <add tagPrefix="asp" namespace="System.Web.UI"

 assembly="System.Web.Extensions, Version=1.0.61025.0   Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>

</controls>

Corrected :-

<controls>

 <add tagPrefix="asp" namespace="System.Web.UI"

 assembly="System.Web.Extensions, Version=1.0.61025.0,   Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>

</controls>

January 23, 2008 3:53 AM
 

Tobias Zimmergren said:

Thanks for pointing that out Hardik. I've made an edit in the post and corrected the tag and added the comma. Cheers

January 23, 2008 6:03 AM
 

Ryan said:

James: try moving the tags in step 7 to the end of your web.config right before the </configuration> tag.  I placed mine at the beginning and got the same error you did - "Unrecognized configuration section system.web.extensions", but moving it to the end made this error go away and the AJAX components are working.

January 29, 2008 2:04 PM
 

Elmo said:

My Ajax is working fine with Smart Part, but if I trytry to use the Toolkit, I always receive the message:

'ajaxToolkit:CalendarExternder' Error

February 18, 2008 12:40 PM
 

Elmo said:

complementing the comment above..

The ERROR is:

Unknown server tag 'ajaxToolkit:CalendarExternder'

Thanks!

February 18, 2008 12:49 PM
 

Tobias Zimmergren said:

Hey Elmo,

Try change from CalendarExternder to CalendarExtender and see if that'll do the trick. (You've mis-spelled Extender).

If that doesn't do the trick, make sure that you've got references to the ajaxToolkit in your UserControl or what ever component you're trying to create :)

That is, import the AjaxControlToolkit dll to Visual Studio, add it to the toolbox and drag'n'drop the CalendarExtender to the web form and Visual Studio will automatically create a reference to the toolkit. Make sure you've got the assembly in your local bin folder or in the GAC aswell.

Hope that helps. If now, send me an email with the code and I'll have a look at it.

Cheers

February 18, 2008 2:36 PM
 

dave said:

Does anyone know if Service Pack 1 for MOSS 2007 has ASP.NET AJAX support built-in?

February 28, 2008 3:50 PM
 

Tom said:

Would you please clarify this post as to whether and how WSS / MOSS SP1 provides AJAX support and how we enable AJAX support for WSS / MOSS SP1 with .NET 3.5, which is supposed to include ajax.asp.net???

March 13, 2008 1:50 PM
 

Naveen Kumar said:

would you please let me know how to remove the help link on the right hand side of the navigation bar

April 3, 2008 12:27 PM
 

Naveen Kumar said:

please provide me with the information on how to provide an option for logout in the inform portal

April 3, 2008 1:21 PM
 

Naveen Kumar said:

can you please tell me how to add a new column in document list in a sharepoint portal.

April 3, 2008 2:54 PM
 

MOSS y WSS3 - Habilitar ASP .NET AJAX 1.0 « jaloplo.net said:

Pingback from  MOSS y WSS3 - Habilitar ASP .NET AJAX 1.0 &laquo; jaloplo.net

April 21, 2008 9:15 AM
 

AlainP said:

Thank you for your changes to the web.config:)

I began to despair not find fully comprehensive tutorials on the topic.

A big thank you:)

Alain

April 23, 2008 10:18 AM
 

cerebral syndrome said:

We are committed to bringing the benefits of bioscience to our patients, by providing umbilical stem cells of the highest quality possible.

May 31, 2008 2:06 PM
 

Cerebral Palsy Child said:

Measures of Cerebral Palsy prevention are increasingly possible today. Pregnant women are tested routinely for the Rh factor and, if Rh negative, they can be immunized within 72 hours after the birth ( or after the pregnancy terminates ) and thereby prevent

June 1, 2008 12:48 AM
 

hnm.mallesh@gmail.com said:

System.InvalidOperationException: Script controls may not be registered before PreRender.

Im getting abov error while using AJAX in sharepoint can any body help pleasssssssss

July 17, 2008 5:14 AM

Leave a Comment

(required )  
(optional )
(required )  
Add

Need SharePoint Training? Attend a SharePoint Bootcamp!

Posts (c) their respective authors. Everything else (c) 2007 SharePoint Experts