3.5 config and ajax config

Jul 31, 2008 at 10:00 PM
Hello:

I am using Visual Studio 2008 (framework 3.5) and wss 3.0, if i need to setup a webpart to use AJAX, what do i need to do?

download 3.5 config and ajax.config, I understand the ajax.config is for framwork2.0, right?

is there an order which config to run?  i mean run 3.5 config first then ajax config? or vice versa?

please advise,
Thank you,
Sep 1, 2008 at 1:10 PM

1.   This will target SharePoint to use ASP.NET 3.5 and AJAX.

 

2.     Locate the web.config file for the web application where the AJAX applications will be hosted. (usually C:\Inetpub\wwwroot\wss\VirtualDirectories\80\web.config)

 

3.     Make a backup of the web.config. Call it web.config.original

  

4.     Open web.config in Visual Studio, and prepare for a copy-paste fest.

 

5.     Find the <configSections> element and add the following code.

 

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

<section name="roleService" type="System.Web.Configuration.ScriptingRoleServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication" />

 

</sectionGroup>

</sectionGroup>

</sectionGroup>

 

6.     Find the <system.web> element then look for the <assemblies> element and add the following code.

 

<add assembly="System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>

 

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

 

<add assembly="System.Data.DataSetExtensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>

 

<add assembly="System.Xml.Linq, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>

 

7.     Also in the <system.web> element, look for the <pages> element and add the following code.

 

<controls>

 

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

 

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

 

</controls>

 

8.     Also in the <system.web> element, look for the <httpHandlers> element and add the following code.

 

<remove verb="*" path="*.asmx"/>

 

<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, System.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"/>

 

9.     Again in the <system.web> element, look for the <httpModules> element and add the following code.

 

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

 

10.  Find the end of the <system.web> element. That is </system.web> and add the following code.

 

<system.codedom>

<compilers>

 

<compiler language="c#;cs;csharp" extension=".cs" warningLevel="4" type="Microsoft.CSharp.CSharpCodeProvider, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">

 

<providerOption name="CompilerVersion" value="v3.5"/>

 

<providerOption name="WarnAsError" value="false"/>

</compiler>

 

<compiler language="vb;vbs;visualbasic;vbscript" extension=".vb" warningLevel="4" type="Microsoft.VisualBasic.VBCodeProvider, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">

 

<providerOption name="CompilerVersion" value="v3.5"/>

 

<providerOption name="OptionInfer" value="true"/>

 

<providerOption name="WarnAsError" value="false"/>

 

</compiler>

</compilers>

</system.codedom>

 

11.  Beneath the code you just copied, end of the </system.codedom>, add the following code. This is only required for IIS7, but there is no harm done adding it if you are using IIS6.

 

<system.webServer>

<validation validateIntegratedModeConfiguration="false"/>

<modules>

<remove name="ScriptModule" />

 

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

 

</modules>

<handlers>

<remove name="WebServiceHandlerFactory-Integrated"/>

<remove name="ScriptHandlerFactory" />

<remove name="ScriptHandlerFactoryAppServices" />

<remove name="ScriptResource" />

 

<add name="ScriptHandlerFactory" verb="*" path="*.asmx" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>

 

<add name="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"/>

 

<add name="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>

 

12.  Find the <runtime> element, look for the <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> element and add the following code to the top of the element.

 

<dependentAssembly>

<assemblyIdentity name="System.Web.Extensions" publicKeyToken="31bf3856ad364e35"/>

<bindingRedirect oldVersion="1.0.0.0-1.1.0.0" newVersion="3.5.0.0"/>

</dependentAssembly>

 

<dependentAssembly>

<assemblyIdentity name="System.Web.Extensions.Design" publicKeyToken="31bf3856ad364e35"/>

<bindingRedirect oldVersion="1.0.0.0-1.1.0.0" newVersion="3.5.0.0"/>

</dependentAssembly>

 

13.  Save the web.config file and access your development portal. If the portal page loads then your changes to the web.config are valid. If not, restore your web.config file (from the backup you made in step 3) and follow the instructions again (this time more carefully!)

 

  Install the AJAX Control Toolkit

 

1.     Download the latest version of the AJAX control toolkit from asp.net

http://www.asp.net/ajax/downloads/

 

(Make sure you download the latest 3.0.x version)

 

2.     Extract the Zip file to you desktop.

 

3.     (if it doesn’t exist) Create the folder C:\Program Files\Reference Assemblies\Microsoft\Ajax

 

4.     Copy the AjaxControlToolkit.dll file into C:\Program Files\Reference Assemblies\Microsoft\Ajax
 

(AjaxControlToolkit.dll can be found in the zip file in the \SampleWebSite\Bin folder)

 

5.     Add the AjaxControlToolkit.dll to the global assembly cache.

 

a.     To do this open a second windows explorer window and navigate to C:\WINDOWS\assembly

 

b.    Drag the AjaxControlToolkit.dll into the assembly folder. (note you can not drag the file onto the assembly folder, you have to drag the file onto the right pane – where the folders contents are shown)

 

6.     Click StartàRun, type regedit and click OK. 

 

7.     When regedit opens, browse to HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NETFramework\AssemblyFolders\

 

8.     Right Click on AssemblyFolders and click NewàKey 


9.     Call the new key Additional (the default will be New Key #1) 

 

10.  In the right pane, double-click (Default), and in the value data text box, type C:\Program Files\Reference Assemblies\Microsoft\Ajax. And click OK

  

11.  Close Regedit

Dec 3, 2008 at 4:11 PM
I thought the whole purpose of the Ajax.config feature was to automate this?

I have the same question as the original poster. Is the ajax.config feature that is available only for .net 2.0 or will it work for asp.net 3.5 as well?