会话变量迷路了 [英] session variable getting lost

查看:64
本文介绍了会话变量迷路了的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

好吧,不要在这个应用程序上为我的设计而努力,这是我的第一个网络应用程序

并且它正在制作中。

我的基本设计是使用通过设计器创建的Datatables,在datatable和ObjectDataSources之间使用业务

逻辑类。

在一个页面中,我有一个带有select的Gridview 。当网格中的一行被选中时,我检索SelectedValue,将值存储在Session

变量中,并将响应重定向到另一个网页,该网页具有

它上面的ObjectDataSource和一个DetailsView。此页面上的ObjectDataSource

从第一页检索Session变量集的值。

问题是Session变量随机丢失其值。

因此,ObjectDataSource的Business对象的SelectMethod接受一个值

选择记录。我怎么知道这个值会丢失?

因为没有返回任何行:

dr = dtAdapter.Rows(0)


抛出异常IndexOutOfRange。


我的问题是,我的会话变量是否有某种原因随机消失




提前致谢


SAL

Okay, don''t bash me to hard for my design on this app, it''s my first web app
and it''s in production.
My basic design is using Datatables created via the designer with a business
logic class in between the datatable and ObjectDataSources.
In one page I had a Gridview with select enabled. When an row in the grid is
selected, I retrieve the SelectedValue, store the value in a Session
variable and redirect the response to another web page, which, has an
ObjectDataSource on it and a DetailsView. The ObjectDataSource on this page
retrieves the value of the Session variable set from the first page. The
problem is that the Session variable is randomly losing its value.
So, the ObjectDataSource''s Business object''s SelectMethod accepts a value to
select records by. How do I know that the value is getting lost?
Because no rows are returned as:
dr = dtAdapter.Rows(0)

throws an exception IndexOutOfRange.

My question is, is there some reason that my session variable evaporates
randomly?

Thanks in advance

SAL

推荐答案

" SAL" < SA*@nospam.nospamwrote in message

news:u5 **************** @ TK2MSFTNGP04.phx.gbl ...
"SAL" <SA*@nospam.nospamwrote in message
news:u5****************@TK2MSFTNGP04.phx.gbl...

我的问题是,我的会话变量是否有某种原因随机消失?

My question is, is there some reason that my session variable evaporates
randomly?



编号会话变量将在会话超时或当他们被覆盖/删除
时丢失 - 这些情况都是这两种情况之一在这里申请......?

-

Mark Rae

ASP.NET MVP
http://www.markrae.net

No. Session variables will be lost when the Session times out, or when they
are overwritten / removed - does either of these situations apply here...?
--
Mark Rae
ASP.NET MVP
http://www.markrae.net


马克,谢谢你的回复。

我在这里看不到这些东西。这个发生了两次这个

早上没有明显的原因然后它没有发生。我没有改变

超时,所以它应该仍然是20分钟而且我没有覆盖它们

就我所见。我无法在我的机器上重现它。


S


" Mark Rae [MVP]" < ma ** @ markNOSPAMrae.net写信息

新闻:%2 **************** @ TK2MSFTNGP05.phx.gbl ...
Mark, thanks for the reply.
I do not see either of these things applying here. This happened twice this
morning for no apparent reason and then it didn''t happen. I have not changed
the time out so it should still be 20 minutes and I am not overwriting them
as far as I can see. I can not reproduce it on my machine.

S

"Mark Rae [MVP]" <ma**@markNOSPAMrae.netwrote in message
news:%2****************@TK2MSFTNGP05.phx.gbl...

" SAL" < SA*@nospam.nospamwrote in message

news:u5 **************** @ TK2MSFTNGP04.phx.gbl ...
"SAL" <SA*@nospam.nospamwrote in message
news:u5****************@TK2MSFTNGP04.phx.gbl...

>我的问题是,我的会话变量是否随机蒸发?
>My question is, is there some reason that my session variable evaporates
randomly?



编号会话变量将在会话超时时丢失,或者当

被覆盖/删除时 - 会遇到以下任何一种情况在这里申请

...?


-

Mark Rae

ASP.NET MVP
http://www.markrae.net


嗨SAL,


根据我的理解,你正在重定向到第二页右边

设置会话变量后,对吗?如果是这种情况,那么由于会话超时,会话变量将丢失,因此没有

。你能否b / b
请仔细检查会话变量是否真的丢失,或者是因为

使用该变量从数据库返回记录的查询返回

空结果?


顺便说一下,还有另一种方法可以在页面之间传递变量使用

Context.Items和Server.Transfer :


#Famil Jones:在ASP.NET页面之间传递变量
http://www.dotnetjunkies.com/WebLog/.../08/11020.aspx

问候,

Walter Wang(wa****@online.microsoft.com,删除''在线。'')

Microsoft在线社区支持


======================================== ==========

在回复帖子时,请回复群组通过你的新闻阅读器

其他人可以从你的问题中学习并从中受益。

==================== ==============================

此帖子提供按现状 ;没有保证,也没有授予任何权利。

Hi SAL,

Based on my understanding, you''re redirecting to the second page right
after setting the session variable, right? If this is the case, there''s no
reason the session variable will be lost due to session timeout. Could you
please double check if the session variable is really lost or it''s because
the query that uses the variable to retrieve records from database returns
empty result?

By the way, there''s another way to pass variables between pages using
Context.Items and Server.Transfer:

#Famil Jones : Pass Variables Between ASP.NET Pages
http://www.dotnetjunkies.com/WebLog/.../08/11020.aspx
Regards,
Walter Wang (wa****@online.microsoft.com, remove ''online.'')
Microsoft Online Community Support

==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.


这篇关于会话变量迷路了的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆