本文介绍了是什么造成这种"长度无效的BASE-64字符数组"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我很少去这里。我不能重现这个地方,但是当用户得到的错误,我得到一个自动的电子邮件异常通知。

I have very little to go on here. I cant reproduce this locally, but when users get the error I get an auto email exception notification.

消息:长度无效的BASE-64字符数组

Message: Invalid length for a Base-64 char array.

调用堆栈:在System.Convert.FromBase64String(String s)将在System.Web.UI.ObjectStateFormatter.Deserialize(字符串inputString)在System.Web.UI.ObjectStateFormatter.System.Web。 UI.IStateFormatter.Deserialize(字符串serializedState)在System.Web.UI.Util.DeserializeWithAssert(IStateFormatter格式,字符串serializedState)在System.Web.UI.HiddenFieldPageStatePersister.Load()

Call Stack: at System.Convert.FromBase64String(String s) at System.Web.UI.ObjectStateFormatter.Deserialize(String inputString) at System.Web.UI.ObjectStateFormatter.System.Web.UI.IStateFormatter.Deserialize(String serializedState) at System.Web.UI.Util.DeserializeWithAssert(IStateFormatter formatter, String serializedState) at System.Web.UI.HiddenFieldPageStatePersister.Load()

我倾向于认为这是与被分配到视图状态数据的问题。例如:

I'm inclined to think there is a problem with data that is being assigned to viewstate.For example:

List<int> SelectedActionIDList = GetSelectedActionIDList();
ViewState["_SelectedActionIDList"] = SelectedActionIDList;

不能够在当地重现错误让人难以猜测错误的来源。

Not being able to reproduce the error locally makes it difficult to guess what the source of the error is.

如果任何人有过与此错误的任何经历,我真的想知道你发现了。

If anyone has had any experience with this error I would really like to know what you found out.

推荐答案

我见过造成和过积极的内容过滤设备/防火墙(尤其是与K-12教育机构打交道的好户型视图状态的组合,这个错误)。

I've seen this error caused by the combination of good sized viewstate and over aggressive content-filtering devices/firewalls (especially when dealing with K-12 Educational institutions).

我们的工作围绕它通过在SQL Server存储视图状态。去之前这条路线,我会建议您尝试通过不存储任何大的它,并把它关闭所有控制哪些不需要它限制你使用视图状态。

We worked around it by storing Viewstate in SQL Server. Before going that route, I would recommend trying to limit your use of viewstate by not storing anything large in it and turning it off for all controls which do not need it.

存储的ViewState在SQL Server中的参考文献:
MSDN - 概述PageStatePersister
ASP联盟 - 简单的方法来视图状态存储在SQL Server
<一href="http://www.$c$cproject.com/Articles/8001/ViewState-Provider-an-implementation-using-Provide">$c$c项目 - ViewState的供应商模式

References for storing ViewState in SQL Server:
MSDN - Overview of PageStatePersister
ASP Alliance - Simple method to store viewstate in SQL Server
Code Project - ViewState Provider Model

这篇关于是什么造成这种&QUOT;长度无效的BASE-64字符数组&QUOT;的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-06 22:46