ASP会话状态 [英] ASP sessionstate

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

问题描述

今天早上我从购物车中删除了cookies。我现在正在使用

会话来跟踪用户。


在我的global.asa中我有以下内容:

sub Session_onStart

session.Timeout = 20

session(" ticket")= CInt(0)

end sub

sub Session_onEnd

设置会话(" ticket")=没有

结束子


我有条件查看票证是0还是空。在我的addtocart.asp

文件中,如果为true,我会分配一个购物车ID。如果为true,在我的购物车和其他页面中,如果

为真,我将用户发送到网络根目录,因为如果票证不大,他们不应该在这些页面上超过0.


它在一个网站上运行良好。另一方面,在第二次购买时,似乎是
失去其状态,从而重定向到网络根目录。


两个网站之间的区别是一个网站有asp和aspx的混合。

这是有问题的。有什么东西我必须用

global.asax或其他东西可以参与吗?


我的商店或购物车里没有.aspx文件。它完全是经典的asp b $ b。我不知道我是否提供了足够的信息,因为ASP

会话对我来说很陌生。


-

Roland Hall

/ *这些信息的分发是希望它有用,但

没有任何保证;甚至没有适销性的暗示保证

或特定用途的适用性。 * /

Technet脚本中心 - http:// www .microsoft.com / technet / scriptcenter /

WSH 5.6文档 - http://msdn.microsoft.com/downloads/list/webdev.asp

MSDN Library - http://msdn.microsoft.com/library/default.asp

I eliminated cookies from my shopping cart this morning. I''m now using
sessions to keep track of users.

In my global.asa I have the following:

sub Session_onStart
session.Timeout = 20
session("ticket") = CInt(0)
end sub
sub Session_onEnd
set session("ticket") = nothing
end sub

I have a conditional to see if ticket is 0 or null. In my addtocart.asp
file, if true, I assign a cart ID. If true, in my cart and other pages, if
true, I send the user to the web root because they should not be on these
pages if ticket is not greater than 0.

It works well on one site. On another, on a 2nd purchase, it appears to
lose its state, thus redirecting to the web root.

The difference between the 2 sites is one site has a mix of asp and aspx.
This is the one with issue. Is there something I must do with the
global.asax or could something else be involved?

There are no .aspx files in my store or shopping cart. It is completely
classic asp. I don''t know if I''ve provided enough information since ASP
sessions are foreign to me.

--
Roland Hall
/* This information is distributed in the hope that it will be useful, but
without any warranty; without even the implied warranty of merchantability
or fitness for a particular purpose. */
Technet Script Center - http://www.microsoft.com/technet/scriptcenter/
WSH 5.6 Documentation - http://msdn.microsoft.com/downloads/list/webdev.asp
MSDN Library - http://msdn.microsoft.com/library/default.asp

推荐答案

Roland Hall于2005年2月8日在

microsoft.public.inetserver.asp.general写道:
Roland Hall wrote on 08 feb 2005 in
microsoft.public.inetserver.asp.general:
sub Session_onEnd
设置会话(" ticket")=没有
end sub
sub Session_onEnd
set session("ticket") = nothing
end sub




为什么会这样?

无论如何,所有会话变量都会在会话结束时丢失。


-

Evertjan。

荷兰。

(Re在我的电子邮件地址中放置带点的所有十字架)



Why is that?

All session variables are lost at the end of the session anyway.

--
Evertjan.
The Netherlands.
(Replace all crosses with dots in my emailaddress)


" Evertjan。在消息新闻中写道:Xn ******************** @ 194.109.133.29 ...

:Roland Hall于2005年2月8日在

:microsoft.public.inetserver.asp.general:



:> sub Session_onEnd

:> set session(" ticket")= no

:>结束子

:>



:为什么?



:无论如何,所有会话变量都会在会话结束时丢失。


感谢您的回复。


我不知道。我只是效仿一个例子。你是说我永远不需要在我的global.asa中为Session_OnEnd清除会话变量吗?


我注意到我无法使用这是在销售结束时(收据)所以我

只是将它设置回0,因为新的销售不应该有相同的购物车ID。


OnEnd中的设置可能是我的问题吗?


-

Roland Hall

/ *这个信息的分发是希望它有用,但

没有任何保证;甚至没有适销性的暗示保证

或特定用途的适用性。 * /

Technet脚本中心 - http:// www .microsoft.com / technet / scriptcenter /

WSH 5.6文档 - http://msdn.microsoft.com/downloads/list/webdev.asp

MSDN Library - http://msdn.microsoft.com/library/default.asp


"Evertjan." wrote in message news:Xn********************@194.109.133.29...
: Roland Hall wrote on 08 feb 2005 in
: microsoft.public.inetserver.asp.general:
:
: > sub Session_onEnd
: > set session("ticket") = nothing
: > end sub
: >
:
: Why is that?
:
: All session variables are lost at the end of the session anyway.

Thanks for your response.

I have no idea. I''m just following an example. Are you saying I never need
anything in my global.asa for Session_OnEnd to clear out a session variable?

I did notice I couldn''t use this at the end of a sale (the receipt) so I
just set it back to 0 because a new sale should not have the same cart ID.

Could the set in OnEnd be the issue I''m having?

--
Roland Hall
/* This information is distributed in the hope that it will be useful, but
without any warranty; without even the implied warranty of merchantability
or fitness for a particular purpose. */
Technet Script Center - http://www.microsoft.com/technet/scriptcenter/
WSH 5.6 Documentation - http://msdn.microsoft.com/downloads/list/webdev.asp
MSDN Library - http://msdn.microsoft.com/library/default.asp



以下是会议有时会消失的一些原因

http://www.aspfaq.com/show.asp?id=2157


在IIS6上,我认为也可能存在一些问题,具体取决于网站如何bb池。请求流程(流程无法共享会话数据)。


-

- Mark Schupp

开发主管

诚信在线学习
www.ielearning.com

" Roland Hall" <没有人@无处>在留言中写道

新闻:%2 ****************** @ TK2MSFTNGP14.phx.gbl ...
Here are some of the reasons that sessions sometimes disappear

http://www.aspfaq.com/show.asp?id=2157

On IIS6 I believe there can also be some problems depending on how the site
"pools" processes for requests (processes cannot share session data).

--
--Mark Schupp
Head of Development
Integrity eLearning
www.ielearning.com

"Roland Hall" <nobody@nowhere> wrote in message
news:%2******************@TK2MSFTNGP14.phx.gbl...
我今天早上从购物车中删除了饼干。我现在正在使用
会话来跟踪用户。

在我的global.asa中,我有以下内容:

子Session_onStart
会话.Timeout = 20
session(" ticket")= CInt(0)
end sub
sub Session_onEnd
设置会话(" ticket")=没有
结束子

我有条件查看票证是0还是空。在我的addtocart.asp
文件中,如果为true,我会分配一个购物车ID。如果是,在我的购物车和其他页面中,如果确实如此,我将用户发送到网络根目录,因为如果故障单不大于0,它们不应该在这些页面上。 br />
它在一个站点上运行良好。另一方面,在第二次购买时,它似乎会失去其状态,从而重定向到网络根目录。

两个网站之间的区别是一个网站混合了asp和aspx 。
这是有问题的。有什么东西我必须用
global.asax或其他东西可以参与吗?

我的商店或购物车里没有.aspx文件。它完全是经典的asp。我不知道我是否提供了足够的信息,因为ASP
会话对我来说很陌生。

-
Roland Hall
/ *此信息分发希望它有用,但
没有任何保证;甚至没有适销性的暗示保证
或适合特定用途的适用性。 * /
Technet脚本中心 - http://www.microsoft.com / technet / scriptcenter /
WSH 5.6文档 -
http://msdn.microsoft.com/downloads/list/webdev.asp
MSDN Library - http://msdn.microsoft.com/library/default.asp
I eliminated cookies from my shopping cart this morning. I''m now using
sessions to keep track of users.

In my global.asa I have the following:

sub Session_onStart
session.Timeout = 20
session("ticket") = CInt(0)
end sub
sub Session_onEnd
set session("ticket") = nothing
end sub

I have a conditional to see if ticket is 0 or null. In my addtocart.asp
file, if true, I assign a cart ID. If true, in my cart and other pages,
if
true, I send the user to the web root because they should not be on these
pages if ticket is not greater than 0.

It works well on one site. On another, on a 2nd purchase, it appears to
lose its state, thus redirecting to the web root.

The difference between the 2 sites is one site has a mix of asp and aspx.
This is the one with issue. Is there something I must do with the
global.asax or could something else be involved?

There are no .aspx files in my store or shopping cart. It is completely
classic asp. I don''t know if I''ve provided enough information since ASP
sessions are foreign to me.

--
Roland Hall
/* This information is distributed in the hope that it will be useful, but
without any warranty; without even the implied warranty of merchantability
or fitness for a particular purpose. */
Technet Script Center - http://www.microsoft.com/technet/scriptcenter/
WSH 5.6 Documentation -
http://msdn.microsoft.com/downloads/list/webdev.asp
MSDN Library - http://msdn.microsoft.com/library/default.asp



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

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