同样的一个语句: Session("ID") = "101"
一个在A.ASPX中
一个在B.ASPX中
接收都是在C.ASPX中:DIM idpd AS STRING = Session("ID").ToString()
A页面传过来的值,C.ASPX能接收,而B页面传过来的值C.ASPX却收不到
这究竟是何道理,有什么条件会对传值产生影响呢?

解决方案 »

  1.   

    A B用一个负值就行了 不用都写
    或B中Session("ID2") = "101"
      

  2.   

    A页面传值语句:   Private Sub Page_Load(ByVal sender As System.Object, ByVal e As     System.EventArgs) Handles MyBase.Load
                             Dim t1 As String = Request("newsid")
                             If (Not (t1 Is Nothing)) Then
                                NewsShow1.newsid = t1
                                Session("ID") = t1
                             End If
                     End SubC页面接收语句: Try
                      idpd = Session("ID").ToString()
                      Label1.Text = Session("ID").ToString()
                      Label1.Text = idpd1
                   Catch ex As System.Exception
                      Response.Write("<script>alert('提交失败  !')</script>")
                   End TryB页面传值语句:Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load            
                  t1 = Request("newsid")
                  Session("ID") = "101"
                  If Not Page.IsPostBack Then
                     ShowScrollAd()
                  End If
                  If (Not (t1 Is Nothing)) Then
                     NewsShow1.newsid = t1
                     News1.IsWrap = True
                     News1.PageRows = 7
                     News1.IsOrderbyFreq = True
                     News1.ImageUrl = "images/arrow-dot.gif"
                     Dim ds As DataSet = New DataSet
                     Dim sql As String
                     sql = "select title,newsid,sj,focus,kind from hq1  where newsid='" & t1 & "'"
                     ds = hsjdata.dbbind(sql)
                     Dim focusstr As String = ds.Tables(0).Rows(0)("focus").ToString
                     Dim classid As Integer = Integer.Parse(ds.Tables(0).Rows(0)("newsid").ToString)
                     If (focusstr = "") OrElse (focusstr Is Nothing) Then
                         News1.ClassId = 1    '显示同类别的新闻
                     Else
                         News1.FocusStr = focusstr    '按关键检索相关新闻
                     End If
                   End If            
            End Sub
      

  3.   

    Dim idpd As String = Session("ID").ToString()
    Try