Page_Unload事件会提前触发 [英] Page_Unload event fires to early

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

问题描述

嗨!


我在C#中有一个Wep应用程序。

Page_Unload在Page_Load之后触发,并且

似乎完全没有当你想要使用这个事件时不合理

_leave_页面。


在我的项目中,我们想使用Page_Unload - 事件来清理

会话变量,但

结果是它在结束前触发,它搞砸了代码,并且

我们得到NullPointerExceptions。 br />

任何人?


问候,

Heidi

他*********** @ nrk.no

推荐答案

我也是,我想要做很多清理工作,但发现有时候垃圾收集器在卸载火灾之前已经访问过了。


" Heidi Hund?la" <他*********** @ nrk.no>在留言中写道

新闻:%2 **************** @ TK2MSFTNGP11.phx.gbl ...
Ya me too, being new wanted to do a lot of cleanup, but found that sometimes
the garbage collector had paid a visit before unload fires.

"Heidi Hund?la" <he***********@nrk.no> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
嗨!

我在C#中有一个Wep应用程序。
Page_Unload会在Page_Load之后触发,而当你想要使用这个事件时,这似乎完全不合理
_leave_页面。

在我的项目中,我们想使用Page_Unload - 事件来清理会话变量,但是当它结束时它会在结束时触发,它会搞砸代码,并且我们得到NullPointerExceptions。

任何人?

问候,
Heidi

他*********** @ nrk.no
Hi !

I have a Wep App in C#.
Page_Unload fires after Page_Load, and
it seems totally unreasonable when you want to use this event when you
_leave_ the page.

In my project we wanted to use the Page_Unload - event to clean up the
Session variables, but
when it turns out that it fires before the end, it screws up the code, and
we get NullPointerExceptions.

Anyone ?

Regards,
Heidi

he***********@nrk.no



雅我也是,我想要做很多清理,但发现有时候垃圾收集器在卸载火灾之前已经访问过了。


" Heidi Hund?la" <他*********** @ nrk.no>在留言中写道

新闻:%2 **************** @ TK2MSFTNGP11.phx.gbl ...
Ya me too, being new wanted to do a lot of cleanup, but found that sometimes
the garbage collector had paid a visit before unload fires.

"Heidi Hund?la" <he***********@nrk.no> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
嗨!

我在C#中有一个Wep应用程序。
Page_Unload会在Page_Load之后触发,而当你想要使用这个事件时,这似乎完全不合理
_leave_页面。

在我的项目中,我们想使用Page_Unload - 事件来清理会话变量,但是当它结束时它会在结束时触发,它会搞砸代码,并且我们得到NullPointerExceptions。

任何人?

问候,
Heidi

他*********** @ nrk.no
Hi !

I have a Wep App in C#.
Page_Unload fires after Page_Load, and
it seems totally unreasonable when you want to use this event when you
_leave_ the page.

In my project we wanted to use the Page_Unload - event to clean up the
Session variables, but
when it turns out that it fires before the end, it screws up the code, and
we get NullPointerExceptions.

Anyone ?

Regards,
Heidi

he***********@nrk.no



但是我想知道什么是去一个页面时清理Session的最佳方法
来自另一个页面的



当会话

本身已经死亡时,会话只由垃圾收集器处理,因此会话可以为一个会话带来很多不可靠的东西时间,这是

导致网络应用程序被重置

当整个应用程序用于大量内存时。


-H


" Rajesh.V" <太阳神*********** @ hotmail.com>在消息中写道

新闻:%2 **************** @ TK2MSFTNGP10.phx.gbl ...
But I wonder what is the best way to clean up Session when going to one page
from another ?

Session is only taken care of by the garbage collector when the Session
itself is dead, hence
the session can carry a lot of unecesarry stuff for a long time, and this is
causing the web app to be reset
when the whole application is using to much memory.

-H

"Rajesh.V" <Ra***********@hotmail.com> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
雅我同样,新人想要做很多清理,但发现
有时垃圾收集者在卸载火灾之前已经访问过了。

Heidi Hund?la <他*********** @ nrk.no>在消息中写道
新闻:%2 **************** @ TK2MSFTNGP11.phx.gbl ...
Ya me too, being new wanted to do a lot of cleanup, but found that sometimes the garbage collector had paid a visit before unload fires.

"Heidi Hund?la" <he***********@nrk.no> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
嗨!

我在C#中有一个Wep应用程序。
Page_Unload会在Page_Load之后触发,当你想要使用这个事件时,这似乎是完全不合理的。
_leave_页面。

在我的项目中,我们想使用Page_Unload - 事件来清理会话变量,但是当结果在结束之前它被触发时,它会搞砸代码,
我们得到NullPointerExceptions。

任何人?

问候,
Heidi

他*********** @ nrk.no




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

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