AUTHOR: Peter Milchev
DATE POSTED: April 12, 2018
Sometimes a "Non-negative number required. Parameter name: length" error is thrown when the Obsolete RadUpload handlers are registered in the web.config file.
Some data loss prevention software might interfere with the proper work of the application even though the RadUpload is not used on the specific page where the error is observed.
The full stack trace of the error is similar to the following:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
[ArgumentOutOfRangeException: Non-negative number required. Parameter name: length] System.Array.CreateInstance(Type elementType, Int32 length) +2855364 Telerik.Web.UI.Upload.RequestParser.GetFieldBytes(Byte[] chunk, Int32 fieldStartIndex, Int32 fieldBytesCount) +39 Telerik.Web.UI.Upload.RequestParser.Parse(Byte[] chunk, Int32 validChunkBytes) +229 Telerik.Web.UI.Upload.ProgressWorkerRequest.UpdateProgress(Byte[] buffer, Int32 validBytes, String caller) +30 Telerik.Web.UI.Upload.ProgressWorkerRequest.GetPreloadedEntityBody() +39 System.Web.HttpRequest.GetEntireRawContent() +388 System.Web.HttpRequest.GetMultipartContent() +56 System.Web.HttpRequest.FillInFormCollection() +222 System.Web.HttpRequest.get_Form() +65 System.Web.HttpRequest.get_HasForm() +3309630 System.Web.UI.Page.GetCollectionBasedOnMethod(Boolean dontReturnNull) +45 System.Web.UI.Page.DeterminePostBackMode() +65 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +133
The solution is to remove the RadUpload related registration in the web.config as suggested in Mandatory Additions to the web.config. The support of the RadUpload is discontinued as of Q2 2012 - https://www.telerik.com/forums/important-support-for-radupload-is-discontinued. That is why we strongly recommend replacing the Obsolete RadUpload control with the new RadAsyncUpload one.
<
configuration
>
appSettings
<!-- Read more at: http://docs.telerik.com/devtools/aspnet-ajax/controls/asyncupload/security -->
add
key
=
"Telerik.AsyncUpload.ConfigurationEncryptionKey"
value
"YOUR-FIRST-UNIQUE-STRONG-RANDOM-VALUE-UNIQUE-TO-YOUR-APP&"
/>
"Telerik.Upload.ConfigurationHashKey"
"YOUR-SECOND-UNIQUE-STRONG-RANDOM-VALUE-UNIQUE-TO-YOUR-APP&"
<!-- Read more at: http://docs.telerik.com/devtools/aspnet-ajax/controls/editor/functionality/dialogs/security -->
"Telerik.Web.UI.DialogParametersEncryptionKey"
"YOUR-THIRD-UNIQUE-STRONG-RANDOM-VALUE-UNIQUE-TO-YOUR-APP&"
</
system.web
<!-- for IIS versions below 7 and Classic Pipeline mode -->
httpHandlers
<!-- This is the primary handler used to fetch most of the needed resources -->
path
"Telerik.Web.UI.WebResource.axd"
type
"Telerik.Web.UI.WebResource"
verb
"*"
validate
"false"
<!-- Only needed for RadSpell and RadEditor's spell checking -->
"Telerik.Web.UI.SpellCheckHandler.axd"
"Telerik.Web.UI.SpellCheckHandler"
<!-- Only needed for the dialogs of RadEditor and RadSpell -->
"Telerik.Web.UI.DialogHandler.aspx"
"Telerik.Web.UI.DialogHandler"
<!-- Only needed if RadAsyncUpload, RadProgressArea/RadProgressManager or the obsolete RadUpload are used -->
"Telerik.RadUploadProgressHandler.ashx"
"Telerik.Web.UI.RadUploadProgressHandler"
<!-- Only needed if the obsolete RadChart is used -->
"ChartImage.axd"
"Telerik.Web.UI.ChartHttpHandler"
httpModules
<!-- Only needed if the obsolete RadUpload is used in the site -->
<!-- <add name="RadUploadModule" type="Telerik.Web.UI.RadUploadHttpModule" /> -->
<!-- Only needed if RadCompression is used in the site. IIS7+ offers built-in dynamic content compression -->
<!-- <add name="RadCompression" type="Telerik.Web.UI.RadCompression" /> -->
system.webServer
<!-- For IIS7+ and Integrated Pipeline mode -->
validation
validateIntegratedModeConfiguration
modules
runAllManagedModulesForAllRequests
"true"
<!-- <remove name="RadUploadModule" /> -->
<!-- <add name="RadUploadModule" type="Telerik.Web.UI.RadUploadHttpModule" preCondition="integratedMode" /> -->
<!-- <remove name="RadCompression" /> -->
<!-- <add name="RadCompression" type="Telerik.Web.UI.RadCompression" preCondition="integratedMode" /> -->
handlers
remove
name
"Telerik_Web_UI_WebResource_axd"
"Telerik_Web_UI_SpellCheckHandler_axd"
"Telerik_Web_UI_DialogHandler_aspx"
"Telerik_RadUploadProgressHandler_ashx"
"ChartImage_axd"
preCondition
"integratedMode"
<!-- Only needed if the obsolete RadChart control is used -->
Resources Buy Try