Why my session used in another page is empty?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • zeejay
    New Member
    • Jul 2010
    • 5

    Why my session used in another page is empty?

    On the Default.aspx
    Code:
    Dim i As Integer
            Dim array1 As ArrayList = New ArrayList()
            For i = 0 To cbBrand.Items.Count - 1
                If cbBrand.Items(i).Selected Then
                    array1.Add(cbBrand.Items(i).Value)
                End If
            Next
            Session("array2") = array1
            Dim city As ArrayList = CType(Session.Item("array2"), ArrayList)
            For i = 0 To city.Count - 1
                Label1.Text += city(i)
            Next
    On the Email2.aspx.cs
    Code:
     
    ArrayList array3 = (ArrayList)Session["array2"];
                for (int i = 0; i < array3.Count; i++)
                {
                    Label1.Text += array3[i];
                }
    There is no value in the array3 in the Email2.aspx.cs
  • Frinavale
    Recognized Expert Expert
    • Oct 2006
    • 9749

    #2
    Looks you have 2 different asp.net web applications here: one is in VB.NET and the other is in C#. Session does not span across different applications. You could try changing your Session to be something where both applications have access to the same data. See this article on Session for more information on the different types of session that you can use.

    -Frinny

    Comment

    Working...