在运行我的 Visual Studio Web 性能测试之一时,我注意到尝试解码视图状态时出现间歇性异常:
消息: Base-64 字符数组的长度无效。
调用堆栈:在 System.Convert.FromBase64String(String s) 在 System.Web.UI.ObjectStateFormatter.Deserialize(String inputString) 在 System.Web.UI.ObjectStateFormatter.System.Web.UI.IStateFormatter.Deserialize(String serializedState) 在System.Web.UI.Util.DeserializeWithAssert(IStateFormatter formatter, String serializedState) 在 System.Web.UI.HiddenFieldPageStatePersister.Load()
这只发生在一个地点的一次测试中。做一些研究,我注意到客户端发送的视图状态和服务器接收的视图状态的不同之处仅在于所有加号(+
)字符都变成了空格()。
这是什么原因造成的?