Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

AjaxControlToolkit 7.0123 breaks VS2012 Web Application Project

I have an existing VS2012 web application that has been running fine until I added in the latest AjaxControlToolkit (7.0123). Initially, I found that the installation broke the behaviour of the UpdatePanel - whereas before I could refresh a page after an asynchronous post-back without repeating the operation I found that after installation the refresh would repeat the previous operation (I guess the post-back was no longer asynchronous).

I then noticed that, at some time in the past, I had commented out a number of the default JavaScript files that are added to a new ASP.NET Web Forms Application so I tried adding them back in. This resulted in an exception:

'MsAjaxBundle' is not a valid script name. The name must end in '.js'.

I then tried replacing the default <asp:ScriptManager .../> with <ajaxControlToolkit:ToolkitScriptManager .../> this resulted in a new exception

Could not load file or assembly 'System.Web' or one of its dependencies. The system cannot find the file specified.

For sanity, I then created a fresh ASP.NET Web Forms Application (VS2012, Update 2) and ran it. No errors. Using "nuget", I then added the AjaxControlToolkit v7.0123 (the latest release). Ran the application again and I get the original exception again:

'MsAjaxBundle' is not a valid script name. The name must end in '.js'.

Once again, I replaced <asp:ScriptManager .../> with <ajaxControlToolkit:ToolkitScriptManager .../> and once again this results in

Could not load file or assembly 'System.Web' or one of its dependencies. The system cannot find the file specified.

Can anybody shed any light on what else I need to do to resolve this? I can find no documentation to say anything needs to be changed manually when adding the toolkit.

Thanks,

like image 375
Martin Robins Avatar asked Apr 06 '13 14:04

Martin Robins


People also ask

What is AjaxToolkit in ASP net?

Ajax Control Toolkit is a web development tool that is an open-source library. It is a joint effort between the ASP.NET Ajax community and Microsoft which provides a very powerful infrastructure for writing customizable, reusable, and extensible ASP.NET Ajax extenders and controls.

Is AJAX Control Toolkit free?

Free to use. If you've used the toolkit in the past, you also know that for quite some time, the project was poorly supported, with an ever growing list of critical issues.

How do I reference Ajaxcontroltoolkit?

Right Click the References in Solution Explorer and select Add Reference,Select "Browse" Tab, Select AjaxToolkit. dll from the "bin" folder from your project folder.


2 Answers

Answer found at http://stephenwalther.com/archive/2012/09/20/september-2012-release-of-the-ajax-control-toolkit.aspx (always just after posting the question huh)

  • Replacing <asp:ScriptManager .../> with <ajaxControlToolkit:ToolkitScriptManager .../> is correct
  • Need to remove reference to MsAjaxBundle
  • Need to remove Assembly="System.Web" from script references

This fixes the exceptions (both in the new project and the original).

It does not however resolve the problem with the UpdatePanel no longer posting back asynchronously. I will raise this as a new question.

like image 82
Martin Robins Avatar answered Sep 20 '22 10:09

Martin Robins


If you are using the April 2013 Release of the Ajax Control Toolkit see Stephen Walther's latest blog post:

http://stephenwalther.com/archive/2013/04/30/april-2013-release-of-the-ajax-control-toolkit.aspx

I was missing the new web.config settings that allow the AjaxFileUpload control to work in the new release

<configuration>
  <system.web>
    <compilation debug="true" targetFramework="4.5" />
    <httpRuntime targetFramework="4.5" maxRequestLength="42949672" />
    <httpHandlers>
      <add verb="*" path="AjaxFileUploadHandler.axd" type="AjaxControlToolkit.AjaxFileUploadHandler, AjaxControlToolkit"/>
    </httpHandlers>
  </system.web>
  <system.webServer>
    <validation validateIntegratedModeConfiguration="false"/>
    <handlers>
      <add name="AjaxFileUploadHandler" verb="*" path="AjaxFileUploadHandler.axd" type="AjaxControlToolkit.AjaxFileUploadHandler, AjaxControlToolkit"/>
    </handlers>
    <security>
      <requestFiltering>
        <requestLimits maxAllowedContentLength="4294967295"/>
      </requestFiltering>
    </security>
  </system.webServer>
</configuration>
like image 40
MoMo Avatar answered Sep 21 '22 10:09

MoMo