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 字符数组的长度无效"的原因是
基础教程推荐
- 如何在 IDE 中获取 Xamarin Studio C# 输出? 2022-01-01
- MS Visual Studio .NET 的替代品 2022-01-01
- rabbitmq 的 REST API 2022-01-01
- 如何激活MC67中的红灯 2022-01-01
- 为什么Flurl.Http DownloadFileAsync/Http客户端GetAsync需要 2022-09-30
- c# Math.Sqrt 实现 2022-01-01
- 将 Office 安装到 Windows 容器 (servercore:ltsc2019) 失败,错误代码为 17002 2022-01-01
- SSE 浮点算术是否可重现? 2022-01-01
- 有没有办法忽略 2GB 文件上传的 maxRequestLength 限制? 2022-01-01
- 将 XML 转换为通用列表 2022-01-01