Telerik AJAX无法上传文件

问题描述 投票:0回答:1

从Telerik AJAX Manager v2015.1.401.45更新到Telerik之后Telerik AJAX Manager v2020.2.512.45无法上传文件。总是像这样的错误:

[CryptographicException: The cryptographic operation has failed!]
   Telerik.Web.UI.CryptoExceptionThrower.ThrowGenericCryptoException() +46
   Telerik.Web.UI.CryptoExceptionThrower.ThrowIfFails(Func`1 function) +46
   Telerik.Web.UI.CryptoService.CheckWhitelistTypes(Type type, String allowedCustomMetaTypes, String uploadMetaDataFullName) +116
   Telerik.Web.UI.AsyncUploadHandler.GetConfiguration(String rawData) +163
   Telerik.Web.UI.AsyncUploadHandler.EnsureSetup() +148
   Telerik.Web.UI.AsyncUploadHandler.ProcessRequest(HttpContext context) +140
   System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +195
   System.Web.HttpApplication.ExecuteStepImpl(IExecutionStep step) +50
   System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +73
telerik telerik-ajax
1个回答
0
投票

该错误记录在产品文档https://docs.telerik.com/devtools/aspnet-ajax/knowledge-base/asyncupload-the-cryptographic-operation-has-failed-error-after-upgrade中。

说明在R1 2020中,默认情况下启用自定义元数据类(上传配置)白名单-将自定义元数据类型列入白名单。如果您的应用程序使用此类配置,则需要将它们添加到web.config中的Telerik.Upload.AllowedCustomMetaDataTypes项中。

您需要添加该类的完全限定名称,否则您将获得密码操作失败!尝试上传时出错。

web.config

<appSettings>
    <add key="Telerik.Upload.AllowedCustomMetaDataTypes" value="SomeNameSpace.SampleAsyncUploadConfiguration;SomeOtherNameSpace.OtherAsyncUploadConfiguration" />
</appSettings>

错误的其他原因如果添加AllowedCustomMetaDataTypes密钥或不使用自定义配置文件不能解决该错误,请确保已设置必要的加密密钥:

ConfigurationEncryptionKey配置哈希键Telerik.Web.UI.DialogParametersEncryptionKey(如果使用RadEditor对话框)>

解决方案解决方案是将所有自定义配置类添加到以分号;分隔的Telerik.Upload.AllowedCustomMetaDataTypes键。要找出标准名称,可以使用以下方法列出标签中的项目。

ASP.NET

<asp:Label Text="Label1" ID="Label1" runat="server" />

C#

protected void Page_Load(object sender, EventArgs e)
{
    Label1.Text = typeof(MySampleAsyncUploadConfiguration).AssemblyQualifiedName.Split(',')[0];
}

[为方便起见,您可以从下面的链接下载实现建议方法的AsyncUploadGetCustomMetaDataTypes示例项目。为了使其可运行,请将Telerik.Web.UI.dll程序集放置在项目的bin文件夹中。

AsyncUploadGetCustomMetaDataTypes.zip。在项目中,您将找到两个带有两个不同的自定义处理程序的页面。如您所见,没有自定义配置的自定义处理程序不需要在Telerik.Upload.AllowedCustomMetaDataTypes键中添加任何内容。

© www.soinside.com 2019 - 2024. All rights reserved.