【发布时间】:2012-05-22 02:48:56
【问题描述】:
已搜索,但找不到好的答案。
我正在开发一个ASP.NET 应用程序。我在应用程序中使用会话变量。
在Firefox 和Chrome 中,它们都有效。
但是在IE(版本 9)中,有一个变量不起作用。目前我不确定它是存储还是检索(或两者兼而有之)。我要存储的变量是 List(T) 类型。这是我正在使用的唯一一种。不禁认为那里有相关性。
另一篇老帖子提到缓存可能导致问题,但我没有很好地理解答案。
附:如果可能,请在VB 中发布任何代码示例。有时我可以阅读C# 并翻译它,有时则不能。
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)
其他答案:Session Variable not working in Internet Explorer, but works fine in Firefox / Chrome
【问题讨论】:
-
您能出示您的代码吗?另外,您能否将链接添加到您认为回答了您的问题但您不理解解决方案的帖子?
-
@jadarnel27 - 好的,我编辑了我的帖子并且不可接受地删除了这个词。还有什么?
-
@SteveWellens 我完全同意您的其余评论 =) 这应该与浏览器无关,除非浏览器导致数据无法在服务器中被捕获会话变量出于某种原因。不过,无论哪种方式,都没有足够的信息来了解。
-
我编辑了您的帖子以整理您的代码。不过,它必须经过同行评审。如果您在我的编辑获得批准之前看到此内容,您可能希望这样做。
标签: asp.net vb.net internet-explorer-9 session-variables