AjaxControlToolkit: error raising upload complete event and start new upload

心不动则不痛 提交于 2021-02-07 03:00:54

问题


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.


回答1:


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>



回答2:


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




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



回答4:


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




回答5:


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>



回答6:


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>                            


来源:https://stackoverflow.com/questions/16814310/ajaxcontroltoolkit-error-raising-upload-complete-event-and-start-new-upload

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!