Search code examples
asp.netvb.netinternet-explorer-9session-variables

Session Variables in IE


Searched, but couldn't find a good answer.

I have an ASP.NET application that I am developing. I'm using session variables within the app.

In Firefox & Chrome, they all work.
But in IE (ver 9), there's one variable that's not working. I'm not sure if it's a storage or a retrieval (or both) at this point. The variable in question that I'm storing is a List(T) type. It's the only one of it's kind that I'm using. Can't help but think there's a correlation there.

One other old post mentioned the possibility that cache is causing the problem, but I didn't understand the answer very well.

P.S. If possible, please post any code samples in VB. Sometimes I can read the C# and translate it, and sometimes not.

Dim Rec_IDs As New List(Of String)
Rec_IDs = Session("Rec_IDs")
and
       Dim Rec_IDs As New List(Of String)
        Dim Rec_ID As Int32
        Rec_IDs = Session("Rec_IDs")
        For Each Row As GridViewRow In gvParts.Rows
            If CType(Row.FindControl("chkSelect"), CheckBox).Checked Then
                Rec_ID = gvParts.DataKeys(Row.RowIndex).Value
                If Not Rec_IDs.Contains(Rec_ID) Then
                    Rec_IDs.Add(Rec_ID)
                End If
                CType(Row.FindControl("chkSelect"), CheckBox).Checked = False
            End If
        Next
Session("Rec_IDs") = Rec_IDs
lblCount.Text = String.Format("You have {0} records selected", Rec_IDs.Count.ToString)

Other answer: Session Variable not working in Internet Explorer, but works fine in Firefox / Chrome


Solution

  • First check your cookies are enabled or not in your browser. If the cookies are blocked that will be the problem with IE

    Also have a look at

    Cookieless ASP.NET, ASP.NET State Management Overview,Difference between browser session and asp.net session