8

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,

Martin Robins
  • 6,033
  • 10
  • 58
  • 95

3 Answers3

12

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.

Martin Robins
  • 6,033
  • 10
  • 58
  • 95
2

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>
MoMo
  • 8,149
  • 3
  • 35
  • 31
0

When you see this "'MsAjaxBundle' is not a valid script name. The name must end in '.js'."

The Best thing you can do is:

  1. Go to the site Master (Double click on it )
  2. Search for "MsAjaxBundle" or " "
  3. Comment this line eg. <%----%>
  4. Save or compile your program and then run it

Thank God is working by now