asp.net - 在 ASP.net 网站上查看状态存在问题
问题描述
我刚刚将我的开发网站移到了一台新计算机上,并且大部分网页都可以正常工作。唯一不能工作的网页是有回发的网页。我知道代码工作正常,这就是为什么我认为它是由视图状态引起的。我不断收到此错误:
Value cannot be null.
Parameter name: inputString
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.ArgumentNullException: Value cannot be null.
Parameter name: inputString
这是引发错误的函数:
Protected Overrides Function LoadPageStateFromPersistenceMedium() As Object
'Dim vState As String = Me.Request.Form("__VSTATE")
PageStatePersister.Load()
Dim vState As String = PageStatePersister.ViewState.ToString
If Not vState Is Nothing Then
Dim bytes As Byte() = System.Convert.FromBase64String(vState)
bytes = vioZip.Decompress(bytes)
Dim format As New LosFormatter
Return format.Deserialize(System.Convert.ToBase64String(bytes))
Else
Return Nothing
End If
End Function
有谁知道它为什么给我这个错误?我找不到传递给它的可能为 null 的内容,但我知道代码本身不会传递任何 null 值。如果您需要更多信息,请告诉我。预先感谢您的回复。
解决方案
检查页面是否有EnableViewState="true"
并验证 web.config 中的站点范围设置 -
<pages enableViewState="true" enableViewStateMac="true" ... />
推荐阅读
- kotlin - IntelliJ 在新的 Ktor 项目中缺少对 slf4j 的引用
- python-3.x - 如何在python中将薪水分类为高/中/低组?
- algorithm - 数据结构与算法最优解说明
- android - 如何在 ViewModel Android 中获取活动上下文?
- django - 使用rest框架的Django自定义url
- php - 在php动态分页中更改记录限制时的问题
- rust - Rust/rocket 将变量传递给端点
- excel - 如何根据其标准将一张 Excel 表格拆分为多张表格
- javascript - 如何仅获取文本输入中插入的字符?
- regex - Safari 对前瞻和后置 RegExp 的支持