What causing this quot;Invalid length for a Base-64 char arrayquot;(导致此“Base-64 字符数组的长度无效的原因是什么?)
问题描述
我在这里几乎没有什么可做的.我无法在本地重现此内容,但是当用户收到错误消息时,我会收到自动电子邮件异常通知:
I have very little to go on here. I can't reproduce this locally, but when users get the error I get an automatic email exception notification:
Invalid length for a Base-64 char array.
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;
如果不能在本地重现错误,就很难猜测错误的来源.
It's difficult to guess the source of the error without being able to reproduce the error locally.
如果有人遇到过这个错误,我真的很想知道你发现了什么.
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 中存储 Viewstate 来解决这个问题.在走这条路之前,我建议尝试限制您对视图状态的使用,不要在其中存储任何大的东西,并为所有不需要它的控件关闭它.
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.
在 SQL Server 中存储 ViewState 的参考:
MSDN - PageStatePersister 概述
ASP 联盟 - 在 SQL Server 中存储视图状态的简单方法
代码项目 - 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
这篇关于导致此“Base-64 字符数组的长度无效"的原因是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:导致此“Base-64 字符数组的长度无效"的原因是


- C#MongoDB使用Builders查找派生对象 2022-09-04
- 带有服务/守护程序应用程序的 Microsoft Graph CSharp SDK 和 OneDrive for Business - 配额方面返回 null 2022-01-01
- Web Api 中的 Swagger .netcore 3.1,使用 swagger UI 设置日期时间格式 2022-01-01
- WebMatrix WebSecurity PasswordSalt 2022-01-01
- MoreLinq maxBy vs LINQ max + where 2022-01-01
- 良好实践:如何重用 .csproj 和 .sln 文件来为 CI 创建 2022-01-01
- 如何用自己压缩一个 IEnumerable 2022-01-01
- 输入按键事件处理程序 2022-01-01
- 在哪里可以找到使用中的C#/XML文档注释的好例子? 2022-01-01
- C# 中多线程网络服务器的模式 2022-01-01