Friday, September 4, 2009

How can I use AJAX.NET 1.0 - System.Web.Extensions, Version=1.0.61025.0

How can I use AJAX.NET 1.0 - System.Web.Extensions, Version=1.0.61025.0

 

If you got this message: "Could not load file or assembly 'System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified."

1. You must copy dll(s) to Bin folder:

AjaxControlToolkit.dll
System.Web.Extensions.dll v1.0.61025.0 or other
System.Web.Extensions.Design.dll v1.0.61025.0

and maybe

AJAXExtensionsToolbox.dll v1.0.61025.0

You may have add those tags and sections to the web.config:

2. Under the <Configuration> tag, add the following <configSections> sections:

Code:

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



3. Under the <system.web> tag, add the following <pages> sections:

Code:

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



3. Under <compilation>, <httpHandlers> and <httpModules> tags:

Code:

    <compilation debug="true">
      <assemblies>
         <add assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
         <add assembly="System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
         <add assembly="System.Web.Extensions.Design, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
         <add assembly="System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
      </assemblies>
   </compilation>
   <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>
   <httpModules>
      <add name="ScriptModule" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
   </httpModules>



5. Under <Configuration> tag, add the following <system.web.extensions> and <system.webServer> sections:

Code:

   <system.web.extensions>
      <scripting>
         <webServices>

            <!-- Uncomment this line to customize maxJsonLength and add a custom converter -->   
            <!-- <jsonSerialization maxJsonLength="500"> -->
            <!--    <converters> -->
            <!--       <add name="ConvertMe" type="Acme.SubAcme.ConvertMeTypeConverter"/>  -->
            <!--    </converters>  -->
            <!-- </jsonSerialization>  -->


            <!-- Uncomment this line to enable the authentication service. Include requireSSL="true" if appropriate. -->
             <!-- <authenticationService enabled="true" requireSSL = "true|false"/> -->

            <!-- Uncomment the lines below 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="propname1,propname2"/> -->

         </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 can read: Add AJAX to an Existing Web Application

6. On IIS7 you must fix web.config with migrate tool or migrate web.confing to Integrated pipeline mode:

6.1 You must migrate the application configuration to work properly in Integrated mode. You can migrate the application configuration with AppCmd:

Code:

> %windir%\system32\inetsrv\Appcmd migrate config "<ApplicationPath>"



6.2 You can migrate manually by moving the custom entries in in the <system.web>/<httpModules> and <system.web>/<httpHandlers> configuration manually to the <system.webServer>/<handlers> and <system.webServer>/<modules> configuration sections, and either removing the <httpHandlers> and <httpModules> configuration OR adding the following to your application’s web.config:

Code:

<system.webServer>
    <validation validateIntegratedModeConfiguration="false" />
</system.webServer>



6.3 Use Classic mode as a last resort if you cannot apply the specified workaround.

Moving to Classic mode will make your application unable to take advantage of ASP.NET improvements made possible in Integrated mode, leveraging future features from both Microsoft and third parties that may require the Integrated mode.

You can read: Breaking Changes for ASP.NET 2.0 applications running in Integrated mode on IIS 7.0

 

Code Formater

Paste Here Your Source Code
Source Code Formatting Options
1) Convert Tab into Space :
2) Need Line Code Numbering :
3) Remove blank lines :
4) Embeded styles / Stylesheet :
5) Code Block Width :
6) Code Block Height :
7) Alternative Background :
Copy Formatted Source Code
 
Preview Of Formatted Code