Adam
Adam

Reputation: 16199

AjaxControlToolkit: error raising upload complete event and start new upload

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.

Upvotes: 7

Views: 14397

Answers (6)

sridharnetha
sridharnetha

Reputation: 2248

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>

Upvotes: 15

suresh
suresh

Reputation: 1

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>                            

Upvotes: 0

BernieSF
BernieSF

Reputation: 1828

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>

Upvotes: 1

Clay Smith
Clay Smith

Reputation: 1079

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

Upvotes: 3

musch
musch

Reputation: 11

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

Upvotes: 1

Adam
Adam

Reputation: 16199

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

Upvotes: 5

Related Questions