7

When using the April 2013 AjaxControlToolkit I receive the error:

0x800a139e - JavaScript runtime error: error raising upload complete event and start new upload

When trying to upload a file using the AjaxFileUpload control.

Adam
  • 16,089
  • 6
  • 66
  • 109

6 Answers6

15

Make sure the following stuff should be present in web.config.

<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>
Adam
  • 6,041
  • 36
  • 120
  • 208
sridharnetha
  • 2,104
  • 8
  • 35
  • 69
5

To resolve the error you need to add this

<httpHandlers>
  <add verb="*" path="AjaxFileUploadHandler.axd" type="AjaxControlToolkit.AjaxFileUploadHandler, AjaxControlToolkit"/>
</httpHandlers>

in your

<system.web>

section of your web.config

Adam
  • 16,089
  • 6
  • 66
  • 109
3

If your app pool is set to classic then this happens unless you use precondition=”integratedMode” added to httphandler for system.webserver

<add name="AjaxFileUploadHandler" verb="*" path="AjaxFileUploadHandler.axd" type="AjaxControlToolkit.AjaxFileUploadHandler, AjaxControlToolkit" preCondition="integratedMode"/>
Clay Smith
  • 1,051
  • 14
  • 27
1

Had the same issue after switching to 4.5. The suggested solution didn't worked until I added full assemply name:

<httpHandlers>
  <add verb="*" path="AjaxFileUploadHandler.axd" type="AjaxControlToolkit.AjaxFileUploadHandler, AjaxControlToolkit, Version=4.5.7.725, Culture=neutral, PublicKeyToken=28F01B0E84B6D53E" />
</httpHandlers> 

Turns out, if you have the 3.5 version in the "old" gac, and 4.5 in the new Microsoft.net/assembly gac, your webapp (IIS?) will not choose the right one!?

musch
  • 11
  • 1
1

Since my application uses forms authentication, I added this to my web.config in order to put the ajaxfileupload to work:

<location path="AjaxFileUploadHandler.axd">
  <system.web>
    <authorization>
      <allow users="*"/>
    </authorization>
  </system.web>
</location>
BernieSF
  • 1,722
  • 1
  • 28
  • 42
0

If anyone still facing the issue even after the changes said by @sridharnetha try to include the below lines.

Important to add UseAbsoluteHandlerPath ="false"

        <ajax:AjaxFileUpload ID="AjaxFileUpload11" runat="server" 
       MaximumNumberOfFiles="3" AllowedFileTypes="txt,xls,xlsx,doc,docx,pdf" 
        Width="400px" UseAbsoluteHandlerPath ="false"
                                    OnUploadComplete="OnUploadComplete" 
    OnClientUploadStart="UploadStart" 
       OnClientUploadCompleteAll="UploadComplete" 
      ClearFileListAfterUpload="true" 
      OnClientUploadError="UploadError"/>

In Web.config

  <httpHandlers>
  <add verb="*" path="http://localhost/AjaxFileUploadHandler.axd" 
 type="AjaxControlToolkit.AjaxFileUploadHandler, AjaxControlToolkit" />

 </httpHandlers>                            
suresh
  • 1