Session_End永远不会触发 [英] Session_End never fires

查看:72
本文介绍了Session_End永远不会触发的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Global.asax.cs的

Session_End方法中有一个带有计数器减法例程的ASP.NET页面:


protected void Session_End(Object sender,EventArgs e)

{


ulong curUsers;


Application.Lock();


curUsers =(ulong)应用程序[" curUsers"];


curUsers - ;


应用程序[" iCurUsers"] = curUsers;


Application.UnLock();


}


基本上,这应该通过跟踪打开会话的数量来跟踪登录系统的用户数量 -

,但Session_End NEVER会触发。我已经检查了我的web.config文件

,它确实将模式显示为InProc:


< sessionState


mode =" InProc"


stateConnectionString =" tcpip = 127.0.0.1:42424"


sqlConnectionString =" data source = 127.0.0.1; Trusted_Connection = yes"


cookieless =" false"


timeout =" 20"


/>


还有其他我错过的东西吗?

I''ve got an ASP.NET page with a counter subtraction routine in the
Session_End method in the Global.asax.cs:

protected void Session_End(Object sender, EventArgs e)

{

ulong curUsers;

Application.Lock();

curUsers = (ulong)Application["curUsers"];

curUsers--;

Application["iCurUsers"] = curUsers;

Application.UnLock();

}

Basically, this is supposed to keep track of the number of users that are
logged into the system by keeping track of the number of open sessions --
except that the Session_End NEVER fires. I''ve checked my web.config file
and it does show the mode as InProc:

<sessionState

mode="InProc"

stateConnectionString="tcpip=127.0.0.1:42424"

sqlConnectionString="data source=127.0.0.1;Trusted_Connection=yes"

cookieless="false"

timeout="20"

/>

Is there something else I missed??

推荐答案

你怎么知道它永远不会发射? Session_End事件发生

通常是在用户关闭浏览器或在其他地方导航

之后的某个时间。由于服务器不知道客户端上发生了什么,

会话结束20(默认情况下,并根据您的web.config文件)分钟

最后一个来自该用户的请求。所以,再次,你确定它永远不会被b $ b b射击吗?


HTH,


Kevin Spencer

Microsoft FrontPage MVP

互联网开发人员
http ://www.takempis.com

有些事情刚刚发生。

其他一切都在发生。


" ; Kenn Ghannon <柯**** @ ameritech.net>在消息中写道

news:yL ******************** @ newssvr28.news.prodigy .com ...
How do you know for sure that it NEVER fires? The Session_End Event happens
usually some time after the user has closed their browser or navigated
elsewhere. As the server has no idea what is happening on the client, the
Session ends 20 (by default, and according to your web.config file) minutes
after the last Request from that user. So, again, are you sure it is NEVER
firing?

HTH,

Kevin Spencer
Microsoft FrontPage MVP
Internet Developer
http://www.takempis.com
Some things just happen.
Everything else occurs.

"Kenn Ghannon" <ke****@ameritech.net> wrote in message
news:yL********************@newssvr28.news.prodigy .com...
我在Global.asax.cs的
Session_End方法中有一个带有计数器减法例程的ASP.NET页面:

protected void Session_End(Object sender,EventArgs e)

{/>


Application.Lock();

curUsers =(ulong)应用程序[curusers"];

curusers--;

应用程序[" iCurUsers"] = curUsers;

Application.UnLock() ;



基本上,这应该通过跟踪打开会话的数量来跟踪登录系统的用户数量 -
除了Session_End NEVER触发。我已经检查了我的web.config文件
它确实将模式显示为InProc:

< sessionState

mode =" InProc"

stateConnectionString =" tcpip = 127.0.0.1:42424"

sqlConnectionString =" data source = 127.0.0.1; Trusted_Connection = yes"

cookieless =" false"

超时=" 20"

/>

我还有什么别的错过吗?
I''ve got an ASP.NET page with a counter subtraction routine in the
Session_End method in the Global.asax.cs:

protected void Session_End(Object sender, EventArgs e)

{

ulong curUsers;

Application.Lock();

curUsers = (ulong)Application["curUsers"];

curUsers--;

Application["iCurUsers"] = curUsers;

Application.UnLock();

}

Basically, this is supposed to keep track of the number of users that are
logged into the system by keeping track of the number of open sessions --
except that the Session_End NEVER fires. I''ve checked my web.config file
and it does show the mode as InProc:

<sessionState

mode="InProc"

stateConnectionString="tcpip=127.0.0.1:42424"

sqlConnectionString="data source=127.0.0.1;Trusted_Connection=yes"

cookieless="false"

timeout="20"

/>

Is there something else I missed??



我打印了curUsers计数器的值(以及另一个

应该跟踪的数量)在主页上访问过

站点的用户。这两个计数器的值总是相等

并同时重置(在应用程序结束之前我已经有两个计数器都超过2000

counter被重置为0 ...因为我有
有一个Application_End()例程,该例程应该将计数器保存到

文件 - 以及随附的Application_Start()常规阅读它所以

当应用程序再次启动时,我可以开始计算我离开的地方

off - 但似乎也似乎也没有。计数器文件是总是设定为

0)。

" Kevin Spencer" <柯*** @ SPAMMERSSUCKtakempis.com>在消息中写道

新闻:#A ************** @ tk2msftngp13.phx.gbl ...
I print the value of the curUsers counter (along with another one that is
supposed to keep track of the number of users that have ever visited the
site) on the home page. The values of these two counters are ALWAYS equal
and get reset at the same time (I''ve had both counters up to over 2000
before the application ended and each counter was reset to 0...because I
have a Application_End() routine that is supposed to save the counter to a
file -- and an accompanying Application_Start() routine to read it in so
that when the application starts again, I can start counting where I left
off -- but never seems to fire either. The counter file is always set to
0).
"Kevin Spencer" <ke***@SPAMMERSSUCKtakempis.com> wrote in message
news:#A**************@tk2msftngp13.phx.gbl...
你怎么知道肯定它永远不会发射? Session_End事件
通常在用户关闭浏览器或在其他地方导航后的某个时间发生。由于服务器不知道客户端上发生了什么,
会话结束20(默认情况下,并根据您的web.config文件)在该用户的最后一个请求后
分钟。所以,再次,你确定它永远不会被解雇吗?

HTH,

Kevin Spencer
Microsoft FrontPage MVP
Internet Developer
http://www.takempis.com
有些事情刚刚发生。
其他一切都发生了。

Kenn Ghannon <柯**** @ ameritech.net>在消息中写道
新闻:yL ******************** @ newssvr28.news.prodigy .com ...
How do you know for sure that it NEVER fires? The Session_End Event happens usually some time after the user has closed their browser or navigated
elsewhere. As the server has no idea what is happening on the client, the
Session ends 20 (by default, and according to your web.config file) minutes after the last Request from that user. So, again, are you sure it is NEVER
firing?

HTH,

Kevin Spencer
Microsoft FrontPage MVP
Internet Developer
http://www.takempis.com
Some things just happen.
Everything else occurs.

"Kenn Ghannon" <ke****@ameritech.net> wrote in message
news:yL********************@newssvr28.news.prodigy .com...
I在Global.asax.cs的
Session_End方法中有一个带有计数器减法例程的ASP.NET页面:

protected void Session_End(Object sender,EventArgs e)

{

ulong curUsers;

Application.Lock();

curUsers =(ulong)应用程序[" curUsers" ;];

curusers--;

应用程序[" iCurUsers"] = curUsers;

Application.UnLock();

}

基本上,这应该通过跟踪打开的
会话的数量来跟踪
登录到系统的用户数量 - 除了Session_End NEVER触发之外。我检查了我的web.config
文件,它确实将模式显示为InProc:

< sessionState

mode =" InProc"

stateConnectionString =" tcpip = 127.0.0.1:42424"

sqlConnectionString =" data source = 127.0.0.1; Trusted_Connection = yes"

cookieless =" false"

超时=" 20"

/>

我还有什么别的错过吗?
I''ve got an ASP.NET page with a counter subtraction routine in the
Session_End method in the Global.asax.cs:

protected void Session_End(Object sender, EventArgs e)

{

ulong curUsers;

Application.Lock();

curUsers = (ulong)Application["curUsers"];

curUsers--;

Application["iCurUsers"] = curUsers;

Application.UnLock();

}

Basically, this is supposed to keep track of the number of users that are logged into the system by keeping track of the number of open sessions -- except that the Session_End NEVER fires. I''ve checked my web.config file and it does show the mode as InProc:

<sessionState

mode="InProc"

stateConnectionString="tcpip=127.0.0.1:42424"

sqlConnectionString="data source=127.0.0.1;Trusted_Connection=yes"

cookieless="false"

timeout="20"

/>

Is there something else I missed??




查找代码逻辑问题,因为它会触发 - 我保证!


,你可以使用SESSION.ABANDON方法强制事件...并设置一个

断点来调试例程...

" Kenn Ghannon" <柯**** @ ameritech.net>在消息中写道

news:p5 ******************** @ newssvr28.news.prodigy .com ...
look for code logic problems, cause it will fire - i promise!

also, you can force the event with SESSION.ABANDON method... and place a
break-point to debug the routine...
"Kenn Ghannon" <ke****@ameritech.net> wrote in message
news:p5********************@newssvr28.news.prodigy .com...
我在主页上打印了curUsers计数器的值(以及另一个用于跟踪曾经访问过
站点的用户数量的计数器)。这两个计数器的值始终相等
并同时重置(在应用程序结束之前我已经有两个计数器都超过2000
并且每个计数器都重置为0 ...因为我有一个Application_End()例程,该例程应该将计数器保存到
文件中 - 以及随附的Application_Start()例程来读取它,以便当应用程序再次启动时,我可以开始计算我离开
的地方 - 但似乎也从未开火。计数器文件总是设置为
0)。

Kevin Spencer <柯*** @ SPAMMERSSUCKtakempis.com>在消息中写道
新闻:#A ************** @ tk2msftngp13.phx.gbl ...
I print the value of the curUsers counter (along with another one that is
supposed to keep track of the number of users that have ever visited the
site) on the home page. The values of these two counters are ALWAYS equal
and get reset at the same time (I''ve had both counters up to over 2000
before the application ended and each counter was reset to 0...because I
have a Application_End() routine that is supposed to save the counter to a
file -- and an accompanying Application_Start() routine to read it in so
that when the application starts again, I can start counting where I left
off -- but never seems to fire either. The counter file is always set to
0).
"Kevin Spencer" <ke***@SPAMMERSSUCKtakempis.com> wrote in message
news:#A**************@tk2msftngp13.phx.gbl...
你怎么知道它确定它永远不会开火? Session_End事件
How do you know for sure that it NEVER fires? The Session_End Event


发生

通常在用户关闭浏览器或在其他地方导航后一段时间。由于服务器不知道客户端上发生了什么,
usually some time after the user has closed their browser or navigated
elsewhere. As the server has no idea what is happening on the client, the
会话结束20(默认情况下,根据您的web.config文件)
Session ends 20 (by default, and according to your web.config file)


分钟

在该用户的最后一次请求之后。所以,再次,你确定它是
永远不会解雇?

HTH,

Kevin Spencer
Microsoft FrontPage MVP
Internet Developer
http://www.takempis.com
有些事情刚刚发生。
其他一切都发生了。

Kenn Ghannon <柯**** @ ameritech.net>在消息中写道
新闻:yL ******************** @ newssvr28.news.prodigy .com ...
after the last Request from that user. So, again, are you sure it is NEVER firing?

HTH,

Kevin Spencer
Microsoft FrontPage MVP
Internet Developer
http://www.takempis.com
Some things just happen.
Everything else occurs.

"Kenn Ghannon" <ke****@ameritech.net> wrote in message
news:yL********************@newssvr28.news.prodigy .com...
I在Global.asax.cs的
Session_End方法中有一个带有计数器减法例程的ASP.NET页面:

protected void Session_End(Object sender,EventArgs e)

{

ulong curUsers;

Application.Lock();

curUsers =(ulong)应用程序[" curUsers" ;];

curusers--;

应用程序[" iCurUsers"] = curUsers;

Application.UnLock();

}

基本上,这应该通过跟踪记录来跟踪
I''ve got an ASP.NET page with a counter subtraction routine in the
Session_End method in the Global.asax.cs:

protected void Session_End(Object sender, EventArgs e)

{

ulong curUsers;

Application.Lock();

curUsers = (ulong)Application["curUsers"];

curUsers--;

Application["iCurUsers"] = curUsers;

Application.UnLock();

}

Basically, this is supposed to keep track of the number of users that


登录系统的用户数量打开的会话数 - 除了Session_End NEVER触发。我检查了我的web.config文件,它确实将模式显示为InProc:

< sessionState

mode =" InProc"

stateConnectionString =" tcpip = 127.0.0.1:42424"

sqlConnectionString =" data source = 127.0.0.1; Trusted_Connection = yes"

cookieless =" false" ;

超时=" 20"

/>

我还错过了其他什么吗?


are logged into the system by keeping track of the number of open sessions -- except that the Session_End NEVER fires. I''ve checked my web.config file and it does show the mode as InProc:

<sessionState

mode="InProc"

stateConnectionString="tcpip=127.0.0.1:42424"

sqlConnectionString="data source=127.0.0.1;Trusted_Connection=yes"

cookieless="false"

timeout="20"

/>

Is there something else I missed??





这篇关于Session_End永远不会触发的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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