I'm using the ajaxcontroltoolkit and i've run into a problem. Here's my code
<div id="DragDrop" style="margin: 20px auto 20px auto; width: 50%;"center">
<ajaxToolkit:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server"
<ajaxToolkit:AjaxFileUpload ID="AjaxFileUpload1" runat="server" Width="70%"
style="margin:0px auto; min-width:300px;"
onuploadcompleteall="AjaxFileUpload1_UploadCompleteAll"
onuploadcomplete="AjaxFileUpload1_UploadComplete" />
<div id="TextUpload" align="center" style="margin: 0px auto 0px auto">
Text/Url Upload:<asp:TextBox id="Text" runat="server">
</asp:TextBox>
</div>
</div>
When I upload my file, I get the red error banner and neither my ajaxfileuploadcomplete nor my ajaxfileuploadallcomplete fire. I searched this on google and none of the fixes i've found apply to this situation.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.IO;
using AjaxControlToolkit;
public partial class Default : FindLocation
{
Guid? CanisterID = null;
Guid? FileID = null;
string path = "";
string name;
string type;
int size;
protected void Page_Load(object sender, EventArgs e)
{
path = Find();
}
protected void AjaxFileUpload1_UploadCompleteAll(object sender, AjaxControlToolkit.AjaxFileUploadCompleteAllEventArgs e)
{
throw new Exception();
}
protected void AjaxFileUpload1_UploadComplete(object sender, AjaxControlToolkit.AjaxFileUploadEventArgs e)
{
throw new Exception();
// Generate file path
string filePath = "~/Images/" + e.FileName;
// Save upload file to the file system
ajaxUpload1.SaveAs(MapPath(filePath));
name = e.FileName;
type = e.ContentType;
size = e.FileSize;
AjaxFileUpload1.SaveAs(MapPath(path));
DataClassesDataContext db = new DataClassesDataContext();
}
}
I added these to my web.config
<system.webServer>
<validation validateIntegratedModeConfiguration="false"/>
<handlers>
<add name="AjaxFileUploadHandler" verb="*" path="AjaxFileUploadHandler.axd" type="AjaxControlToolkit.AjaxFileUploadHandler, AjaxControlToolkit"/>
</handlers>
</system.webServer>
<system.web>
<httpHandlers>
<add verb="*" path="AjaxFileUploadHandler.axd" type="AjaxControlToolkit.AjaxFileUploadHandler, AjaxControlToolkit"/>
</httpHandlers>
I put this at the top of the page
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="ajaxToolkit" %>
And also I don't have any querystrings on this page. Any idea what's wrong? ![Heres a picture of the error][1]