Asp.net 在某些情况下,回发时不保留会话变量

Asp.net 在某些情况下,回发时不保留会话变量,asp.net,session,Asp.net,Session,在我的一个ASP网站中,我面临会话变量的问题 下面是我的代码摘录 If Page.IsPostBack = False And newFrmReply = False Then Dim mystream As IO.Stream mystream = Request.InputStream() Dim filebytes(mystream.Length) As Byte mystream.Read(filebytes,

在我的一个ASP网站中,我面临会话变量的问题

下面是我的代码摘录

    If Page.IsPostBack = False And newFrmReply = False Then

        Dim mystream As IO.Stream

        mystream = Request.InputStream()
        Dim filebytes(mystream.Length) As Byte
        mystream.Read(filebytes, 0, mystream.Length)
        For i = 0 To UBound(filebytes)
            If filebytes(i) <> 0 Then
                reg.poststr = reg.poststr & Chr(filebytes(i))
            End If

        Next
        Session("poststring") = reg.poststr 
    Else
        reg.poststr = Session("poststring") 
    End If

    serial = reg.getvalueFromUrl("Serial", reg.poststr)


    If serial > 0 Then
            TxtSl_no.Text = Mid(serial, 1, 5)
    Else
            TxtSl_no.Visible = True
            lblSerialNo.Visible = True
    End If
如果Page.IsPostBack=False和newFrmReply=False,则
将mystream设置为IO.Stream
mystream=Request.InputStream()
Dim filebytes(mystream.Length)作为字节
读取(文件字节,0,mystream.Length)
对于i=0到UBound(filebytes)
如果filebytes(i)为0,则
reg.poststr=reg.poststr&Chr(文件字节(i))
如果结束
下一个
Session(“poststring”)=reg.poststr
其他的
reg.poststr=会话(“poststring”)
如果结束
serial=reg.getvalueFromUrl(“serial”,reg.poststr)
如果串行>0,则
TxtSl_no.Text=Mid(串行,1,5)
其他的
TxtSl_编号可见=真
lblSerialNo.Visible=True
如果结束
最初,会话(“poststring”)是从发布到URL的字符串设置的。我们已经给了一个ASP按钮。在按钮上单击“回发”按钮。 回发后,无论在何处读取会话,它都会返回空字符串。
发布到URL的字符串不是空的,因为TxtSl_no.Text具有非空值(基于发布的字符串)。 在web.config中,我已将会话超时设置为24小时<代码>。 在99%的客户端PC中,此代码运行良好。只有少数几台电脑会将空白字符串保存到数据库中


回发时,将保留txtsl_no.text viewstate。因此,在回发时,txtsl_no.文本被保留。

可能是它在
reg.poststr
中获得空值?发布到URL的字符串不是空的,因为txtsl_no.文本具有非空值(基于发布的字符串)。今天,我们再次在同一台PC中检查。但这不是给错。工作很好。前天我们试了3到4次,每次都有错误。