Ajax Toolkit AjaxFileUpload throw exception

2019-07-06 03:32发布

问题:

I have an entry form which I want to add a file uploader I added a toolkit script manager to the master page then i added an ajaxfileupload control <http://www.asp.net/ajaxLibrary/AjaxControlToolkitSampleSite/AjaxFileUpload/AjaxFileUpload.aspx>

the aspx looks like this

<ajaxToolkit:AjaxFileUpload ID="AjaxFileUpload1" ThrobberID="myThrobber" ContextKeys="fred"
                AllowedFileTypes="jpg,jpeg" MaximumNumberOfFiles="2" runat="server" UploadedComplete="AjaxFileUpload1_UploadedComplete" />

the method AjaxFileUpload1_UploadedComplete is empty for now.

I got this exception and no event is firing except for the page_load

Sys.ArgumentException: Sys.ArgumentException: Cannot deserialize. The data does not correspond to valid JSON.

回答1:

I realise this is an old question but i think this is caused by a 'bug' in the control. It appends query string parameters but assumes there are no existing parameters.

There are details and a fix here: https://ajaxcontroltoolkit.codeplex.com/workitem/27149 (involves changing the source and rebuilding the toolkit)