【问题标题】:Having issue with View State on ASP.net Website在 ASP.net 网站上查看状态有问题
【发布时间】:2018-12-08 22:49:08
【问题描述】:

我刚刚将我的开发网站移到了一台新计算机上,并且大部分网页都可以正常工作。唯一不能工作的网页是有回发的网页。我知道代码工作正常,这就是为什么我认为它是由视图状态引起的。我不断收到此错误:

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 值。如果您需要更多信息,请告诉我。提前感谢您的回复。

【问题讨论】:

    标签: asp.net vb.net visual-studio


    【解决方案1】:

    检查页面是否有EnableViewState="true"

    并验证 web.config 中的站点范围设置 -

    <pages enableViewState="true" enableViewStateMac="true" ... />
    

    【讨论】:

      猜你喜欢
      • 2012-06-01
      • 2012-09-20
      • 1970-01-01
      • 1970-01-01
      • 2013-01-27
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多